NAS-based directory deletion method and apparatus, and client and server
By replacing multiple interactive instructions with batch deletion instructions in the distributed NAS server cluster, the problem of excessive resource consumption during NAS directory deletion is solved, and efficient directory deletion operations are achieved.
Patent Information
- Application Number
- PCT/CN2024/075754
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-08-15
- Filing Date
- 2024-02-04
- Publication Date
- 2024-12-12
AI Technical Summary
When deleting directories, the existing NAS directory deletion method involves a large amount of client and server interaction, occupying network bandwidth and computing resources, increasing response time, and requiring a large amount of file metadata to be cached, resulting in excessive memory resource consumption.
A distributed NAS server cluster is adopted to replace multiple readdir and delete instructions through a single batch delete instruction, reducing the number of interactions between the client and the server, avoiding the client caches metadata, and reducing memory resource consumption.
It significantly reduces the computing resource overhead and network bandwidth overhead of NAS clients, shortens the response time for directory deletion, reduces the burden on servers, and improves the performance of file deletion operations.
Smart Images

Figure CN2024075754_12122024_PF_FP_ABST
Abstract
Description
NAS-based directory deletion method, device, client and server
[0001] This application claims priority to Chinese patent application No. 202310678018.6, filed on June 8, 2023, entitled “A NAS operation method for batch deleting files”, and priority to Chinese patent application No. 202311035113.0, filed on August 15, 2023, entitled “NAS-based directory deletion method, device, client and server”, 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 is mounted on a NAS server, if it needs to delete a directory on 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 in the subdirectory and cache the obtained metadata of each file; the NAS client sends an open command for the subdirectory to the NAS server, and the NAS server opens the subdirectory and adds a delete tag to the files in the subdirectory. After adding the delete 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 in the directory, and the NAS server first deletes the files in the subdirectory and then deletes the subdirectory, finally completing 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, it will occupy a large amount of memory resources and computing resources of the NAS client, affecting the NAS client's execution of other operations.
[0005] Summary of the Invention
[0006] The present invention provides a NAS-based directory deletion method, device, client, and server, which can reduce the computing resource and network bandwidth overhead of a NAS client when deleting a directory from a NAS server. This method also prevents the NAS client from caching files in subdirectories, thereby reducing the consumption of NAS client memory resources. The technical solution is as follows.
[0007] In a first aspect, a method for deleting a directory based on NAS is provided, which is executed by a NAS server that provides background services for a NAS client. The method includes:
[0008] 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 server where the sub-directories are located, and sends a deletion completion response to the NAS client.
[0009] Among them, the first NAS server is the NAS server in the distributed NAS server cluster that stores the target directory. 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.
[0010] In the above method, a single batch delete command is used to replace a large number of readdir commands and delete commands on the NAS client. This 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 on the NAS client.
[0011] Optionally, the target directory further includes multiple files, and the method further includes:
[0012] The first NAS server deletes the multiple files in the target directory from the first NAS server based on the target directory indicated by the batch deletion instruction.
[0013] 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.
[0014] Optionally, the method further includes:
[0015] The second NAS server in the distributed NAS server cluster receives the distributed deletion instruction, and generates multiple distributed deletion instructions for multiple subdirectories under the subdirectory based on the subdirectory indicated by the received distributed deletion instruction. 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 instruction of the corresponding subdirectory to the NAS server where each subdirectory in the subdirectory is located.
[0016] Among them, each NAS server in the distributed NAS server cluster that stores subdirectories or files of each level of the target directory executes the above process in sequence according to the corresponding subdirectory hierarchy until all subdirectories and files of each level under the target directory are deleted.
[0017] In the above method, each NAS server in the distributed NAS server cluster that stores subdirectories or files of each level of the target directory performs the deletion operation in sequence according to the corresponding subdirectory hierarchy, avoiding the deletion task being performed by a single NAS server and reducing the burden on the NAS server.
[0018] Optionally, the subdirectory further includes multiple files, and the method further includes:
[0019] The second NAS server deletes the multiple files in the subdirectory from the second NAS server based on the subdirectory indicated by the received distributed deletion instruction.
[0020] Optionally, the subdirectories indicated by different distributed deletion instructions are located on different NAS servers.
[0021] Optionally, the batch deletion instruction further carries a deletion mode identifier, where the deletion mode identifier is used to indicate a deletion operation mode to be performed by the first NAS server on the target directory, where the deletion operation mode is either a synchronous deletion mode or an asynchronous deletion mode.
[0022] Optionally, the first NAS server sending a deletion completion response to the NAS client includes:
[0023] 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.
[0024] 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 proactively 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.
[0025] Optionally, the method further includes:
[0026] If the directory has not been 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 is used to indicate that the target directory has not been deleted;
[0027] The first NAS server sending a deletion completion response to the NAS client includes: the first NAS server receiving 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;
[0028] 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. The query response corresponding to the last query instruction in at least one query instruction indicates that the target directory has been deleted.
[0029] 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 proactively sends a second deletion response to the NAS client indicating that the target directory has not been deleted. At the same time, 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 promptly learn and synchronize the deletion status of the target directory, thereby improving the performance of the NAS file deletion operation.
[0030] Optionally, the method further includes:
[0031] 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 completely deleted. The first NAS server sends a deletion completion response to the NAS client, including: if the directory has been completely deleted, it sends an asynchronous deletion response to the NAS client, and the asynchronous deletion response indicates that the target directory has been deleted.
[0032] 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.
[0033] 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 background services by a NAS server, and the method includes:
[0034] 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, where the batch deletion instruction instructs to delete the target directory; the NAS client receives a deletion completion response sent by the first NAS server, where the deletion completion response indicates that the target directory has been deleted; and the NAS client displays a deletion success prompt of the target directory, where the deletion success prompt indicates that the target directory has been deleted.
[0035] Optionally, the batch deletion instruction further carries a deletion mode identifier, where the deletion mode identifier is used to indicate a deletion operation mode to be performed by the first NAS server on the target directory. The deletion operation mode is either a synchronous deletion mode or an asynchronous deletion mode.
[0036] Optionally, the NAS client receiving the deletion completion response sent by the first NAS server includes:
[0037] 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.
[0038] Optionally, the method further includes:
[0039] The NAS client receives a second deletion response sent by the first NAS server, which 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 the deletion task identifier and 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. The query response corresponding to the last query instruction sent by the NAS client indicates that the target directory has been deleted.
[0040] Optionally, the method further includes:
[0041] The NAS client receives a second deletion response sent by the first NAS server, where 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, 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, where the asynchronous deletion response indicates that the target directory has been deleted.
[0042] In a third aspect, a NAS-based directory deletion device is provided, which includes 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.
[0043] In a fourth aspect, a NAS-based directory deletion device is provided, which includes 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.
[0044] In a fifth aspect, a NAS server is provided, comprising a processor and a memory, the memory storing program code, the processor being configured to execute the program code, so that the NAS server executes the NAS-based directory deletion method provided in the first aspect or any possible implementation of the first aspect.
[0045] 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 program code, and the processor is used to execute the program code, so that the distributed NAS server cluster performs the NAS-based directory deletion method provided by the first aspect or any possible implementation of the first aspect.
[0046] In a seventh aspect, a NAS client is provided, comprising a processor and a memory, the memory storing program code, the processor configured to execute the program code, so that the NAS client performs the NAS-based directory deletion method provided in the first aspect or any possible implementation of the first aspect.
[0047] Based on the implementation methods provided in the above aspects, this application can also be further combined to provide more implementation methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] FIG1 is a schematic diagram of an implementation environment of a NAS-based directory deletion method provided in an embodiment of the present application;
[0049] FIG2 is a flowchart of a NAS-based directory deletion method provided in an embodiment of the present application;
[0050] FIG3 is a flowchart of a NAS-based directory deletion method provided in an embodiment of the present application;
[0051] FIG4 is a flow chart of a NAS-based directory deletion method in a synchronous deletion mode provided by an embodiment of the present application;
[0052] FIG5 is a flowchart of a NAS-based directory deletion method provided in an embodiment of the present application;
[0053] FIG6 is a flow chart of a NAS-based directory deletion method in an asynchronous deletion mode provided by an embodiment of the present application;
[0054] FIG7 is a schematic structural diagram of a NAS-based directory deletion device provided in an embodiment of the present application;
[0055] FIG8 is a schematic structural diagram of a NAS-based directory deletion device provided in an embodiment of the present application;
[0056] FIG9 is a schematic structural diagram of a NAS client provided in an embodiment of the present application;
[0057] FIG10 is a schematic structural diagram of a NAS server provided in an embodiment of the present application;
[0058] FIG11 is a schematic diagram of the structure of a distributed NAS server cluster provided in an embodiment of the present application. DETAILED DESCRIPTION
[0059] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0060] First, the implementation environment of the embodiment of the present application is introduced.
[0061] Figure 1 is a schematic diagram illustrating an implementation environment for a NAS-based directory deletion method provided in an embodiment of the present application. As shown in Figure 1 , the implementation environment includes a NAS client 101 and a distributed NAS server cluster 102, wherein distributed NAS server cluster 102 includes multiple NAS servers. NAS client 101 and distributed NAS server cluster 102 communicate with each other via a wired or wireless network.
[0062] The NAS client 101 may be a Windows server message block (SMB) client or a Linux or Unix network file system (NFS) client, but this embodiment of the present application does not limit this. The NAS client 101 may run on at least one terminal selected from a desktop computer, a laptop computer, a virtual reality computing device, an augmented reality computing device, a wireless computing device, and a portable laptop computer. The NAS client 101 has a communication function and can access the Internet. The NAS client 101 may generally refer to one of multiple NAS clients. Those skilled in the art will appreciate that the number of the above-mentioned NAS clients may be greater 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 delete 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 delete operation or 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 receiving the response from the first NAS server indicating that the target directory has been deleted, the NAS client 101 displays a directory deletion success prompt, which indicates that the target directory has been deleted.
[0063] 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 embedded system software, which can provide cross-platform file sharing functions. The NAS server can be an SMB server for Windows, or an NFS server for Linux or Unix, which is not limited in the embodiments of the present application. For example, 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. Illustratively, the first NAS server in the distributed NAS server cluster 102 is capable of receiving a delete instruction or query instruction sent by the NAS client 101, and based on the received instruction, performs the corresponding delete operation or query operation, and returns a corresponding response to the NAS client 101. The delete operation mode performed by the first NAS server is one of a synchronous delete mode and an asynchronous delete mode. In some embodiments, the first NAS server provides a batch delete interface that can be invoked by the batch delete instruction sent by the NAS client to perform the directory delete operation.
[0064] In some embodiments, the wireless or wired network utilizes standard communication technologies and / or protocols. The network is typically the Internet, but can 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 dedicated network, or any combination of virtual private networks. In some embodiments, data blocks exchanged over the network between the NAS client 101 and the distributed NAS server cluster 102 are represented using technologies and / or formats such as Hypertext Markup Language (HTML) and Extensible Markup Language (XML). Furthermore, conventional encryption technologies such as Secure Sockets Layer (SSL), Transport Layer Security (TLS), Virtual Private Networks (VPN), and Internet Protocol Security (IPsec) can be used to encrypt all or some of the links. In other embodiments, customized and / or dedicated data communication technologies can be used in place of or in addition to the aforementioned data communication technologies.
[0065] An embodiment of the present application provides a NAS-based directory deletion method. In this method, after a first NAS server in a distributed NAS server cluster receives a batch delete instruction from a NAS client indicating the deletion of a target directory, it generates distributed delete instructions for multiple subdirectories within the target directory, sends the corresponding distributed delete instructions to the NAS servers where the subdirectories reside, and sends a deletion completion response to the NAS client. In this method, using a single batch delete instruction instead of a large number of readdir and delete instructions from the NAS client can significantly reduce the number of interactions between the NAS client and the NAS server, lowering the NAS client's computing resource overhead and network bandwidth overhead. It also prevents the NAS client from caching metadata for the target directory, thereby reducing the NAS client's memory resource consumption.
[0066] 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.
[0067] (1) Batch Delete Instruction: This batch delete instruction is used to instruct the deletion of target directories. This batch delete instruction 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 to be performed on the target directory by the first NAS server in the distributed NAS server cluster. The deletion operation mode can be either synchronous deletion mode or asynchronous deletion mode.
[0068] The batch delete instruction can be represented by the following command word FULL_PATH_REMOVE:
[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] 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_REMOVE resok res switch (nfsstat4status) 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); 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).
[0073] (3) Query command: This query command is used to query the execution result of the deletion task corresponding to the batch deletion command. The query command carries the deletion task identifier and verification code corresponding to the batch deletion command.
[0074] The query instruction can be represented by the following command word QUERY_PATH_DEL:
[0075] Where query_id represents the deletion task ID corresponding to the batch deletion instruction, and verf represents the verification code.
[0076] (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.
[0077] The query response can be represented by the following command word struct QUERY_PATH_DEL 4res: struct QUERY_PATH_DEL 4res { nfsstat4 status;}
[0078] Among them, status indicates the execution result of the deletion task.
[0079] (5) Asynchronous Delete Response: This asynchronous delete response is used to return the deletion task execution result to the NAS client when the target directory has been deleted in asynchronous delete mode. This asynchronous delete response carries the deletion task identifier, verification code, and the deletion task execution result. The execution result of the deletion task is that the target directory has been deleted.
[0080] The asynchronous delete response can be represented by the following command word CB_FULL_PATH_REMOVE:
[0081] Among them, query_id represents the deletion task identifier corresponding to the batch deletion instruction, verf represents the verification code, and 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.
[0082] 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. The embodiments of this application do not limit this.
[0083] Based on the above instructions and responses, the following describes in detail the process of a NAS-based directory deletion method provided in an embodiment of the present application. The batch deletion instruction sent by the NAS client may carry a deletion mode identifier, which indicates the deletion operation mode to be performed on the target directory by the first NAS server in the distributed NAS server cluster, where the deletion operation mode is either synchronous deletion mode or asynchronous deletion mode. Accordingly, upon receiving the batch deletion instruction, the NAS server may delete the target directory in either synchronous deletion mode or asynchronous deletion mode based on the deletion mode identifier in the batch deletion instruction.
[0084] The following first introduces the method by taking the synchronous deletion mode as an example. 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 fails to 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 inquire about 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.
[0085] First, let's take the case where a distributed NAS server cluster completes the deletion of a target directory within a first preset time period as an example. Figure 2 is a flowchart of a NAS-based directory deletion method provided by an embodiment of the present application. As shown in Figure 2, 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.
[0086] 201. In response to a delete operation performed on a target directory on the NAS client, the NAS client sends a batch delete instruction to a first NAS server in the distributed NAS server cluster. The batch delete instruction instructs to delete the target directory. The batch delete instruction carries a delete mode identifier, which is used to indicate that the delete operation mode performed by the first NAS server on the target directory is a synchronous delete mode.
[0087] Among them, the deletion operation performed on the target directory on the NAS client can be performed by first selecting the target directory on the NAS client and then selecting the "Delete" option by right-clicking the mouse, or by first selecting the target directory on the NAS client and then clicking 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 are not limited in the embodiments of the present application.
[0088] Among them, the first NAS server is the NAS server in the distributed NAS server cluster that stores the target directory. 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.
[0089] The NAS client sends the batch delete 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 delete instruction to the SMB server based on a stateful protocol (SMB protocol). In response to a delete 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 the 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; only after receiving the response to the close instruction does the SMB client send the batch delete 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, in response to the deletion operation on the target directory on the NFS client, first sends a directory read (readdir) instruction for the target directory to the NFS server; after receiving the readdir instruction, the NFS server returns the 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.
[0090] 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. The multiple distributed deletion instructions instruct to delete multiple subdirectories under the target directory, and the multiple subdirectories are distributed on multiple NAS servers in the distributed NAS server cluster.
[0091] 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 a distributed deletion instruction corresponding to each NAS server.
[0092] 203. The first NAS server sends a distributed deletion instruction of the corresponding subdirectory to each NAS server where the subdirectory in the plurality of subdirectories is located.
[0093] Among them, the subdirectories indicated by different distributed deletion instructions can be located in different NAS servers or in the same NAS server, and this embodiment of the present application does not limit this.
[0094] It should be noted that the above steps 202 and 203 are described using the example of a target directory containing only subdirectories. In some embodiments, the target directory contains only files, and the files in the target directory are stored on the first NAS server. When the first NAS server receives a batch delete instruction for the target directory, it deletes the files in the target directory from the first NAS server. In other embodiments, the target directory contains both subdirectories and files. When the first NAS server receives a delete instruction for the target directory, it generates a distributed delete instruction corresponding to each subdirectory, sends the distributed delete instruction to the corresponding NAS server, and deletes the files in the target directory from the first NAS server.
[0095] 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 on the second NAS server. If the subdirectory of the target directory only contains 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 contains next-level subdirectories, the second NAS server generates distributed deletion instructions for multiple subdirectories under the subdirectory and sends the corresponding distributed deletion instructions to the NAS server where each subdirectory in the subdirectory is located. If the subdirectory of the target directory contains both files and next-level subdirectories, the second NAS server first generates a distributed deletion instruction for each subdirectory in the subdirectory and 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 similar to steps 202 to 203 above and will not be repeated here. Each NAS server in the distributed NAS server cluster that stores subdirectories or files of the target directory executes the above process in sequence according to the corresponding subdirectory hierarchy until all subdirectories and files of the target directory are deleted.
[0096] 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.
[0097] 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 to be shorter; if the response delay requirement of the distributed NAS server cluster is longer, the first preset duration is set to be longer. This embodiment of the present application is not limited to this.
[0098] The target directory has been deleted completely, which means that all subdirectories and files at all levels under the target directory have been deleted completely.
[0099] 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 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.
[0100] 205. The NAS client receives the first deletion response and displays a prompt indicating that the target directory has been deleted successfully. The prompt indicates that the target directory has been deleted.
[0101] 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. The embodiment of the present application does not limit this.
[0102] 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. 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, avoids the consumption of a large amount of memory resources, computing resources and bandwidth resources, and shortens the time. The response delay is reduced; further, each NAS server in the distributed NAS server cluster that stores subdirectories or files of each level of the target directory performs 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 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 the NAS file deletion operation.
[0103] The following describes an example of a distributed NAS server cluster failing to delete a target directory within a first preset time period in synchronous mode. FIG3 is a flow chart of a NAS-based directory deletion method provided by an embodiment of the present application. As shown in FIG3 , using the interaction between a NAS client and a distributed NAS server cluster as an example, the method includes steps 301 to 308.
[0104] 301. In response to a delete operation performed on a target directory on the NAS client, the NAS client sends a batch delete instruction to a first NAS server in the distributed NAS server cluster. The batch delete instruction instructs to delete the target directory. The batch delete instruction carries a delete mode identifier, which is used to indicate that the delete operation mode performed by the first NAS server on the target directory is a synchronous delete mode.
[0105] 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. The multiple distributed deletion instructions instruct to delete multiple subdirectories under the target directory, and the multiple subdirectories are distributed on multiple NAS servers in the distributed NAS server cluster.
[0106] 303. The first NAS server sends a distributed deletion instruction of the corresponding subdirectory to each NAS server where the subdirectory in the multiple subdirectories is located.
[0107] Steps 301 to 303 are similar to the above-mentioned steps 201 to 203 and are not described in detail.
[0108] 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.
[0109] 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, and the embodiment of the present application does not limit this. 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.
[0110] 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 for the target directory.
[0111] 305. The NAS client receives the second deletion response and stores the deletion task identifier and verification code carried in the second deletion response.
[0112] 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.
[0113] 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 in the second deletion response.
[0114] 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 will be longer. If the target directory occupies fewer storage resources, the second preset time length will be shorter. Since the time taken 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 target directory still not being 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.
[0115] 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.
[0116] 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 the at least one query instruction indicates that the target directory has been deleted.
[0117] 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.
[0118] Each time the first NAS server receives a query instruction, it queries the execution result of the deletion task indicated by the deletion task identifier based on the deletion task identifier carried in the query instruction, and returns a query response to the NAS client based on the query execution result. The execution result of the deletion task is either: the target directory has been deleted or the target directory has not been deleted.
[0119] In some embodiments, each time the first NAS server receives a query instruction, it matches the verification code carried in the query instruction with the verification code stored in the first NAS server. If the match is unsuccessful, an error message is returned. If the match is successful, the execution result of the deletion task indicated by the deletion task identifier is queried. In this method, the first NAS server verifies the verification code carried in the query instruction before querying the execution result of the deletion task, and only queries if the verification is successful. This can avoid invalid queries and save computing resources of the first NAS server.
[0120] 308. The NAS client receives a query response returned by the first NAS server based on each query instruction.
[0121] If the execution result of the deletion task carried in any query response indicates that the directory has been deleted, the NAS client displays a prompt indicating that the target directory has been successfully deleted. This process is similar to step 205 above and is not further described. If the execution result of the deletion task carried in any query response indicates that the directory has not been deleted, the NAS client continues to execute step 306 above, that is, sending query instructions to the first NAS server every second preset time period until the target directory is deleted. In some embodiments, if the target directory has not been deleted within a third preset time period, the NAS client no longer sends query instructions to the first NAS server and instead returns an error message indicating that the target directory deletion failed.
[0122] 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. 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, avoids the consumption of a large amount of memory resources, computing resources and bandwidth resources, and shortens the response delay. Furthermore, the distributed In the NAS server cluster, each NAS server storing 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 being executed by a single NAS server, which can reduce 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. At the same time, the distributed NAS server cluster continues to execute the deletion task, so that the NAS client regularly 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.
[0123] The following uses Figure 4 as an example to illustrate the processes shown in Figures 2 and 3. Figure 4 is a flow chart of a NAS-based directory deletion method in a synchronous deletion mode provided by an embodiment of the present application. As shown in Figure 4, 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 uses 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 NFS4_PENDING, it delays sending the query command (QUERY_FULL_PATH_REMOVE). The query command needs to carry query_id and verf. If the query command received by the first NAS server contains query_id and verf information, the first NAS server compares the query_id and verf in the command with the cached query_id and verf. If the comparison fails, it reports an error; if the comparison is successful, it returns a query response 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, it returns the first deletion response carrying query_id and verf and the first error code (the error code in the case of NFS4_OK) to the NAS client, and the NAS client displays a prompt indicating that the target directory has been successfully deleted.
[0124] The embodiments shown in Figures 2 and 3 above are described using the synchronous deletion mode as an example. The following description uses the asynchronous deletion mode as an example. Figure 5 is a flow chart of a NAS-based directory deletion method provided in an embodiment of the present application. As shown in Figure 5, 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.
[0125] 501. In response to a delete operation performed on a target directory on the NAS client, the NAS client sends a batch delete instruction to a first NAS server in the distributed NAS server cluster. The batch delete instruction instructs to delete the target directory. The batch delete instruction carries a delete mode identifier. The delete mode identifier indicates that the delete operation performed on the target directory by the first NAS server is in asynchronous delete mode.
[0126] This step 501 is similar to the above step 201, except that the deletion mode identifier carried by the batch deletion instruction in step 501 indicates that the first NAS server performs an asynchronous deletion operation on the target directory, while the deletion mode identifier carried by the batch deletion instruction in step 201 indicates that the first NAS server performs a synchronous deletion operation on the target directory. The similarities are not repeated here.
[0127] 502. The first NAS server receives the batch deletion instruction and sends a second deletion response to the NAS client. The second deletion response indicates that the target directory has not been completely deleted.
[0128] Step 502 is similar to step 302 above, except that in step 502, upon receiving the batch delete instruction, the first NAS server immediately sends the second delete response to the NAS client, whereas in step 302, the first NAS server sends the second delete response to the NAS client only if it fails to complete the deletion of the target directory within the second preset time period. The similarities are not further described.
[0129] 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 instruct to delete multiple subdirectories under the target directory. The multiple subdirectories are distributed on multiple NAS servers in the distributed NAS server cluster.
[0130] 504. The first NAS server sends a distributed deletion instruction of each subdirectory in the target directory to the NAS server where each subdirectory in the target directory is located.
[0131] Step 503 and step 504 are similar to the above-mentioned steps 202 and 203 and are not described in detail.
[0132] 505. The NAS client receives the second deletion response and stores the deletion task identifier and verification code carried in the second deletion response.
[0133] The step 505 is similar to the above step 305 and will not be described in detail.
[0134] 506. The NAS client starts an asynchronous snoop task to receive the asynchronous deletion response sent by the first NAS server.
[0135] 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.
[0136] The asynchronous delete response carries the deletion task identifier, verification code, and execution result of the deletion task corresponding to the batch delete instruction, wherein the execution result of the deletion task is that the target directory has been deleted. The asynchronous delete response can be represented by the command word CB_FULL_PATH_REMOVE, which is not repeated here.
[0137] 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.
[0138] 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.
[0139] The process of displaying a prompt indicating that the target directory has been successfully deleted in step 508 is the same as that of step 205 above, and will not be repeated here.
[0140] The following uses Figure 6 as an example to illustrate the process shown in Figure 5 above. Figure 6 is a flow chart of a directory deletion method based on NAS in an asynchronous deletion mode provided by an embodiment of the present application. As shown in Figure 6, 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 uses the asynchronous deletion mode when executing the deletion task; 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 target directory has not been deleted (NFS4_PENDING), that is, the second error code, and carries the query_id The first NAS server then returns a second deletion response with the query_id and verf as well as the second error code to the NAS client. The distributed NAS server cluster then 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 for NFS4_PENDING (the second error code), it starts an asynchronous listening task 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 an asynchronous deletion response (CB_FULL_PATH_REMOVE) carrying the execution result of the deletion task to the NAS client via the NFS4 reverse channel. The asynchronous deletion response also carries the 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) for the target directory is destroyed, and the deletion task is forcibly terminated with the destruction of the session.
[0141] 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. The NAS client does not need to send deletion instructions for 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. 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 the NAS file deletion operation.
[0142] Figure 7 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.
[0143] The instruction receiving module 701 is configured to receive a batch deletion instruction sent by a NAS client, wherein the batch deletion instruction instructs deletion of a target directory;
[0144] An instruction generation module 702 is configured to generate, based on the target directory indicated by the batch deletion instruction, a plurality of distributed deletion instructions, wherein the plurality of distributed deletion instructions instruct to delete a plurality of subdirectories under the target directory, the plurality of subdirectories being distributed across a plurality of NAS servers in the distributed NAS server cluster;
[0145] An instruction sending module 703 is configured to send a distributed deletion instruction of the corresponding subdirectory to each NAS server where the subdirectory in the multiple subdirectories is located;
[0146] The response sending module 704 is configured to send a deletion completion response to the NAS client, where the deletion completion response indicates that the target directory has been deleted.
[0147] Optionally, the target directory further includes multiple files, and the device further includes:
[0148] A deleting module is configured to delete, based on the target directory indicated by the batch deletion instruction, multiple files under the target directory from the first NAS server.
[0149] Optionally, the subdirectories indicated by different distributed deletion instructions are located on different NAS servers.
[0150] Optionally, the batch deletion instruction further carries a deletion mode identifier, where the deletion mode identifier is used to indicate a deletion operation mode to be 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.
[0151] Optionally, the response sending module 704 is configured to:
[0152] 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.
[0153] Optionally, the response sending module 704 is configured to:
[0154] If 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;
[0155] 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;
[0156] Based on each query instruction, a corresponding query response is returned to the NAS client, 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.
[0157] Optionally, the response sending module 704 is configured to:
[0158] When receiving the batch deletion instruction, sending a second deletion response to the NAS client, where the second deletion response is used to indicate that the directory has not been completely deleted;
[0159] 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.
[0160] 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 by hardware. For example, the implementation of the instruction receiving module 701 is described below using 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.
[0161] As an example of a software functional unit, the instruction receiving module 701 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Furthermore, the 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 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 one data center or multiple geographically close data centers. Typically, a region may include multiple AZs.
[0162] Similarly, multiple hosts / virtual machines / containers running the code can be distributed within the same virtual private cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Cross-region communication between two VPCs within the same region, or between VPCs in different regions, requires a communication gateway within each VPC to interconnect the VPCs.
[0163] As an example of a hardware functional unit, the instruction receiving module 701 may include at least one computing device, such as a server. Alternatively, the instruction receiving module 701 may be 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.
[0164] 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.
[0165] 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 to illustrate 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.
[0166] FIG8 is a schematic 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 .
[0167] an instruction sending module 801, 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 instructs to delete the target directory;
[0168] a response receiving module 802, 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;
[0169] The display module 803 is configured to display a deletion success prompt of the target directory, where the deletion success prompt indicates that the target directory has been deleted.
[0170] Optionally, the batch deletion instruction further carries a deletion mode identifier, where the deletion mode identifier is used to indicate a deletion operation mode to be 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.
[0171] Optionally, the response receiving module 802 is configured to:
[0172] 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.
[0173] Optionally, the response receiving module 802 is configured to:
[0174] receiving a second deletion response sent by the first NAS server, where the second deletion response indicates that the target directory has not been deleted;
[0175] If the NAS client receives a second deletion response from 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;
[0176] Receive a query response returned by the first NAS server based on each query instruction, where 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.
[0177] Optionally, the response receiving module 802 is configured to:
[0178] receiving a second deletion response sent by the first NAS server, where the second deletion response indicates that the target directory has not been deleted;
[0179] An asynchronous deletion response is received from the first NAS server, where the asynchronous deletion response indicates that the target directory has been deleted.
[0180] 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 to illustrate 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.
[0181] This application provides a NAS client, as shown in Figure 9. Figure 9 is a schematic diagram of the structure of a NAS client provided in an embodiment of the application. NAS client 900 can be a host, server, or personal computer. NAS client 900 can be implemented using a general bus architecture.
[0182] The NAS client 900 includes at least one processor 901 , a communication bus 902 , a memory 903 , and at least one communication interface 904 .
[0183] 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.
[0184] Communication bus 902 is used to transmit information between the above components. Communication bus 902 can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one line is used in Figure 9, but this does not mean that there is only one bus or one type of bus.
[0185] The memory 903 is, for example, a read-only memory (ROM) or other type of static storage device that can store static information and instructions, or a random access memory (RAM) or other type of dynamic storage device 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 compact 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 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.
[0186] The communication interface 904 uses any transceiver or other 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. 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.
[0187] As an embodiment, the processor 901 may include one or more CPUs.
[0188] As an example, the NAS client 900 may include multiple processors, each of which may be a single-core processor (single-CPU) or a multi-core processor (multi-CPU). A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0189] 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 can display information in various 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 can receive user input in various ways. For example, the input device may be a mouse, keyboard, touch screen device, or sensor device.
[0190] 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.
[0191] Figure 10 is a schematic diagram of the structure of a NAS server provided in an embodiment of the present application. The NAS server 1000 may vary significantly due to different configurations or performance, and may include one or more processors (central processing units, CPUs) 1001 and one or more memories 1002. The one or more memories 1002 store at least one program code, which 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 input / output interfaces for input and output. The NAS server 1000 may also include other components for implementing device functions, which are not detailed here.
[0192] Figure 11 is a structural diagram of a distributed NAS server cluster provided in an embodiment of the present application. As shown in Figure 11, the distributed NAS server cluster 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.
[0193] 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, storage, display, 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 the relevant laws, regulations, and standards of the relevant countries and regions. For example, the directories and files involved in this application were obtained with full authorization.
[0194] Those skilled in the art will appreciate that the various method steps and units described in conjunction with 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 terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may 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.
[0195] Those skilled in the art will clearly understand that, for the sake of 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.
[0196] In the several embodiments provided in this 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. In actual implementation, there may be other division methods, 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 can be electrical, mechanical or other forms of connection.
[0197] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present application.
[0198] In addition, each unit in each embodiment of the present application may be integrated into a processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The above-mentioned integrated units may be implemented in the form of hardware or software units.
[0199] 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 for enabling 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: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0200] In this application, the terms "first", "second", etc. are used to distinguish between identical or similar items having 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 there a limit on quantity and execution order. 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 the 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.
[0201] As used herein, the term "at least one" means one or more, and the term "plurality" means two or more. For example, a plurality of delete instructions refers to two or more delete instructions. The terms "system" and "network" are often used interchangeably herein.
[0202] 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 [stated condition or event] is detected" may be interpreted to mean "upon determining that..." or "in response to determining that..." or "upon detecting [stated condition or event]" or "in response to detecting [stated condition or event]," depending on the context.
[0203] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and such modifications or substitutions should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
[0204] In the above embodiments, all or part of the embodiments may be implemented using software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented 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 processes or functions described in the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
[0205] 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 via a wired or wireless method. 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. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, or a magnetic tape), an optical medium (e.g., a digital video disc (DVD), or a semiconductor medium (e.g., a solid-state drive)), etc.
[0206] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or may be accomplished by a program to instruct the relevant hardware, 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.
[0207] 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, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate 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 should indicate 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 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 in the distribution Multiple NAS servers in a 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
Patent Citations
Directory deletion method and device based on NAS (Network Attached Storage), client and server
CN119106008A
Directory deletion method and device, and storage server
CN108885671A
File deletion method, device and equipment and storage medium
CN109766317A
File deletion method, apparatus and device, and readable storage medium
CN110941591A
NAS distributed file system and data processing method
CN111209259A
Cited By
Method and equipment for quickly deleting catalogs and files
CN121681475A
