Data access method and apparatus, and device
Patent Information
- Application Number
- PCT/CN2023/101128
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-01-17
- Filing Date
- 2023-06-19
- Publication Date
- 2025-04-03
AI Technical Summary
The existing data migration solution needs to be restarted when client business accesses, resulting in poor business continuity, and the file handle application and migration process is time-consuming, affecting business continuity.
Provide a data access method. The client accesses the copied file in the target storage device through the handle of the source file. There is no need to restart the business or apply for a new handle. The target storage device queries and accesses the copied file in the handle mapping list to ensure business continuity. And forward the request to the source storage device when the access is abnormal.
It achieves data migration with zero downtime, reduces cutover time, and ensures business continuity and data access stability.
Smart Images

Figure CN2023101128_03042025_PF_FP_ABST
Abstract
Description
Data access method, device and equipment
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on November 7, 2022, with application number 202211386991.2 and application name “A data migration method”, and the Chinese patent application filed with the State Intellectual Property Office of China on January 17, 2023, with application number 202310094863.9 and application name “Data access method, device and equipment”, all contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of computer technology, and in particular to a data access method, apparatus and device. Background Art
[0003] A network-attached storage (NAS) device is a storage device located on a network. It provides data storage services, such as file sharing and data backup, to client computers over the network. NAS devices centrally store and manage data, reducing the burden on clients to store data locally. Consequently, NAS devices are becoming increasingly popular.
[0004] Client services require access to data stored on NAS devices. In some cases, data stored on one NAS device needs to be migrated to another. Current data migration solutions require restarting the client's service, resulting in poor business continuity.
[0005] Summary of the Invention
[0006] Provided are a data access method, apparatus, and device, which can improve business continuity.
[0007] In a first aspect, a data access method is provided, which includes: a target storage device receives a file access request sent by a client, the file access request includes a first handle, wherein the source file identified by the first handle is not located on the target storage device; the target storage device queries a second handle corresponding to the first handle in a handle mapping list, and accesses a target file identified by the second handle, wherein the target file is located on the target storage device.
[0008] A handle, also known as a file handle, is used to identify and access a file. Different files have different handles. When a file is copied, the handles of the copied file and the copied file are also different. The same file also has different file handles on different devices. In other words, even if two files have the same content and other characteristics, their handles will be different if they are located on different devices.
[0009] The target file identified by the second handle is obtained by copying the source file identified by the first handle, that is, the target file identified by the second handle is a copy of the source file identified by the first handle. The target file identified by the second handle can also be called a copy file of the source file identified by the first handle. Among them, in the data migration scenario (that is, the file is migrated or copied from one device to another device), the target file identified by the second handle is the file generated by copying the source file identified by the first handle to the target storage device. Specifically, during data migration, the source file is copied to obtain the target file, and the target file is migrated to the target storage device. The second handle is the identifier assigned by the target storage device to the target file when the target file is migrated to the target storage device. The target storage device can use the second handle to identify and access the target file.
[0010] For the client, in the existing technical solution, after the client connects to the target storage device, in order to obtain the file handle of the file in the target storage device, it is necessary to restart the business (restart the client, or the client restarts the application) to delete the file handle of the source file and apply for the file handle of the target file from the target storage device, so as to use the file handle allocated by the target storage device to send a file access request to achieve access to the file. Business restart will cause business disconnection, that is, poor business continuity. In addition, applying for file handles is also time-consuming, further reducing business continuity.
[0011] In the method provided in the embodiment of the present application, after the client connects to the target storage device, it still uses the file handle of the source file, that is, the handle of the file in the device where the source file is located, to send a file access request to achieve file access. Therefore, in this method, the client does not need to restart the business, and the business can be maintained. In addition, in this method, the client does not need to apply to the target storage device for the file handle of the file in the target storage device, thereby further ensuring the continuity of the business. In fact, the client will not even perceive that the actual handle of the accessed file is different from the file access request.
[0012] When the target storage device receives a file access request, it queries the source file's file handle for the handle corresponding to the source file's file handle. The retrieved file handle is the target file's file handle obtained by copying the source file. The target file can then be accessed based on the retrieved file handle. The target file is a copy of the source file, and accessing the target file is equivalent to accessing the source file, thus satisfying the client's data needs.
[0013] In short, the data access method provided by the embodiment of the present application ensures business continuity while meeting the client's data needs in the data migration scenario.
[0014] In a possible implementation, the first handle is an identifier of the target file in other storage devices before the target file is copied to the target storage device.
[0015] The target file is a copy of the source file identified by the first handle, and the target file and the source file can be considered the same file. As mentioned above, the same file has different file handles on different devices. Therefore, the first handle can be called the identifier of the target file in the other device before it is copied to the target storage device, while the second handle is the identifier of the target file in the target storage device.
[0016] In a possible implementation, the method further includes: when an exception occurs in access to the target file, the target storage device forwards the access request to the source storage device where the source file is located, so as to access the source file.
[0017] In this embodiment, when the target storage device cannot normally access the target file, the target storage device can forward the client's file access request to the source storage device where the source file is located, allowing the source storage device to access the source file to meet the client's data needs. The first handle in the file access request is originally the file handle in the source storage device. The source storage device can promptly access the file based on the first handle, and the possibility of access anomalies is extremely small. Therefore, even if the storage device connected to the client switches to the target storage device and the target storage device cannot normally access the file, the client's data needs can still be met in a timely manner, ensuring business continuity.
[0018] In one possible implementation, the device address of the target storage device is the same as the device address of the source storage device where the source file is located. The device address is used for client access. Before the target storage device receives the file access request, the method also includes: enabling the device address of the target storage device; and disabling the device address of the source storage device.
[0019] The target storage device uses the same device address as the source storage device to connect to the client. When switching the client's storage device from the source to the target, simply disable the source device's address and enable the target's address to complete the switch. This is convenient. Furthermore, the client's device address remains unchanged, eliminating the need to re-establish a network connection. This means the client doesn't need to re-mount the storage device when switching storage devices, reducing cutover time and further ensuring business continuity for the client.
[0020] In a possible implementation, when a target storage device fails, the method further includes: disabling a device address of the target storage device; and re-enabling the device address of the source storage device.
[0021] In this embodiment, when a target storage device fails, the storage device connected to the client can be switched to the source storage device, so that the source storage device continues to provide data services to the client. The client can send a file access request to the source storage device, and the source storage device accesses the source file to meet the client's data needs. The first handle in the file access request is originally the file handle in the source storage device. The source storage device can access the file in a timely manner based on the first handle, and the possibility of access anomalies is extremely small. Therefore, when the storage device connected to the client switches to the target storage device and the target storage device fails, the client's data needs can be met in a timely manner, ensuring business continuity.
[0022] In a possible implementation, the method further includes: when an exception occurs in access to the target file, the target storage device deactivates the device address of the target storage device; and re-enables the device address of the source storage device.
[0023] In this embodiment, when the target storage device cannot access the target file normally, the storage device connected to the client can be switched to the source storage device so that the source storage device continues to provide data services to the client. The client can send a file access request to the source storage device, and the source storage device accesses the source file to meet the client's demand for data. The first handle in the file access request is originally the file handle in the source storage device. The source storage device can access the file in a timely manner based on the first handle, and the possibility of access anomalies is extremely small. Therefore, when the target storage device cannot access the file normally, the storage device connected to the source storage device is switched back to the source storage device. The client's demand for data can also be met in a timely manner, ensuring business continuity.
[0024] In one possible implementation, the method further includes: when the second handle does not exist in the handle mapping list, sending a copy request to the source storage device where the source file is located, the copy request includes the first handle, and the copy request is used to request the source storage device to copy the source file to the target storage device.
[0025] In this implementation, if the handle mapping list does not contain a second handle corresponding to the first handle, the source file has not yet been copied to the target storage device. In this case, the target storage device can specifically send a copy request to the source storage device to instruct the source storage device to copy the source file to the target storage device. This eliminates the need to copy the source file to the target storage device according to the established data migration order, but can prioritize copying the source file to the target storage device. This allows the target storage device to obtain a copy of the source file, i.e., the target file, in a timely manner, enabling timely access to the target file and ensuring business continuity.
[0026] In one possible implementation, the source file identified by the first handle and located in the source storage device is in a locked state, and the method further includes: the target storage device sets the target file identified by the second handle to be in a locked state, wherein the owner of the access rights of the target file in the locked state is consistent with the owner of the access rights of the source file in the locked state.
[0027] In this implementation, after a file is copied from a source storage device to a target storage device, the lock status of the file can also be synchronized, so there is no need to reapply for locking the file copied to the target storage device, saving time in reapplying for locking and further ensuring business continuity.
[0028] In a possible implementation, the target storage device setting the target file to a locked state includes: the target storage device obtaining locking information generated when the source file enters the locked state; and the target storage device setting the target file to a locked state based on the locking information.
[0029] In this implementation, the target storage device can directly use the locking information of the source file to lock the target file, eliminating the need to reapply for locking, saving time for locking applications and further ensuring business continuity.
[0030] In a possible implementation, the method further includes: when it is detected that the client that triggers the source file to enter the locked state is the same as the client that sends the access request, confirming that the access to the target file is legal.
[0031] In this implementation, whether the access to the target file is legal can be determined by detecting whether the client that triggers the source file lock and the client that sends the access request are the same. Only when it is detected that the client that triggers the source file lock and the client that sends the access request are the same, the access is confirmed to be legal, thereby preventing illegal access to the file and ensuring data security.
[0032] In the second aspect, a data access device is provided, which is configured on a target storage device. The device includes: a receiving unit, used to receive a file access request sent by a client, the file access request includes a first handle, wherein the source file identified by the first handle is not located in the target storage device; an access unit, used to query the second handle corresponding to the first handle in the handle mapping list, and access the target file identified by the second handle, wherein the target file is located in the target storage device.
[0033] In a possible implementation, the apparatus further includes: a sending unit configured to forward an access request to a source storage device where the source file is located, when an exception occurs in access to the target file, so as to access the source file.
[0034] In a possible implementation, the device address of the target storage device is the same as the device address of the source storage device where the source file is located. The device address is used for client access. The apparatus further includes: an enabling unit, configured to enable the device address of the target storage device.
[0035] In a possible implementation, the apparatus further includes: a deactivation unit, configured to deactivate a device address of the target storage device when a failure occurs in the target storage device.
[0036] In a possible implementation, the apparatus further includes: a deactivation unit, configured to deactivate a device address of a target storage device when an abnormality occurs in access to the target file.
[0037] In one possible implementation, the device also includes: a sending unit, used to send a copy request to the source storage device where the source file is located when the second handle does not exist in the handle mapping list, the copy request includes the first handle, and the copy request is used to request the source storage device to copy the source file to the target storage device.
[0038] In one possible implementation, the source file identified by the first handle and located in the source storage device is in a locked state, and the apparatus further includes: a setting unit for setting the target file identified by the second handle to be in a locked state, wherein the owner of the access rights of the target file in the locked state is consistent with the owner of the access rights of the source file in the locked state.
[0039] According to a third aspect, a computer is provided, comprising: a memory for storing an executable program; and a processor for executing the first aspect by running the executable program.
[0040] In a fourth aspect, a computer-readable storage medium is provided, comprising computer program instructions. When the computer program instructions are executed by a computing device, the computing device executes the method provided in the first aspect.
[0041] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed by a computer device, causes the computer device to execute the method provided in the first aspect.
[0042] Among them, the beneficial effects of the second to fifth aspects can be found in the above description of the beneficial effects of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] FIG1 is a schematic diagram of a system architecture provided in an embodiment of the present application;
[0044] FIG2 is a schematic diagram of a software structure of a target storage device provided in an embodiment of the present application;
[0045] FIG3 is a flow chart of a data access method provided in an embodiment of the present application;
[0046] FIG4 is a diagram showing the effect of the data access method provided in an embodiment of the present application;
[0047] FIG5 is a flow chart of a data access method provided in an embodiment of the present application;
[0048] FIG6 is a schematic structural diagram of a data access device provided in an embodiment of the present application;
[0049] FIG7 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0050] The following will describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments.
[0051] In the description of this specification, "one embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in conjunction with the embodiment is included in one or more embodiments of this specification. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in yet other embodiments," etc., appearing in different places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized.
[0052] In the description of this specification, unless otherwise specified, " / " means or. For example, A / B can mean A or B. "And / or" in this specification is only a description of the association relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of this specification, "plurality" means two or more than two.
[0053] In the description of this specification, the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of the technical features indicated. Therefore, features specified as "first" or "second" may explicitly or implicitly include one or more of such features. The terms "including," "comprising," "having," and their variations all mean "including but not limited to," unless otherwise specifically emphasized.
[0054] With the advancement of communication technology, computing systems that adopt a storage-computing separation architecture have become possible. In this architecture, data is stored on NAS devices. Clients can read or write data to the NAS devices when executing tasks, enabling business operations. Based on this architecture, cloud service providers can provide external data storage services. Tenants using data storage services can store data on the cloud service provider's NAS devices over the network, reducing their data storage costs.
[0055] In some scenarios, for example, when replacing a low-storage-performance NAS device with a high-storage-performance NAS device, or when changing cloud service providers, data in the source NAS device needs to be migrated to the target NAS device. Migrating data between different NAS devices involves cutover. Cutover means that the NAS device to which the client is connected switches from the source NAS device to the target NAS device and starts using the NAS device for business. During the cutover, the connection between the client and the source NAS device needs to be disconnected, and a connection between the client and the target NAS device needs to be established. Since the client performs business by accessing the data in the NAS device, business will be interrupted during the cutover. In order to ensure business continuity, the shorter the cutover period, the better. The cutover period can also be referred to as the cutover duration.
[0056] In Solution A1, the process of migrating data from the source NAS device to the target NAS device is divided into two phases. In the first phase, the client remains connected to the source NAS device and continues to access the source NAS device to perform business. In the second phase, cutover is performed. During the cutover, the source NAS device needs to be scanned for the incremental data generated by the client during the data migration, and then the incremental data needs to be migrated to the target NAS device. Since it takes a long time to scan the incremental data, especially when the client business is busy and the amount of incremental data is large, it may take several hours to scan the incremental data. The long incremental data scanning time prolongs the cutover time, causing serious impact on business continuity.
[0057] In Solution A2, during the data migration process, the client's services are stopped and disconnected from the source NAS device. The client is then connected to the target NAS device and its services are restarted. The client continues its services by accessing the target NAS device. While Solution A2 shortens the cutover time compared to Solution A1, it does require restarting the client's services and also involves a certain cutover time, resulting in poorer service continuity.
[0058] An embodiment of the present application provides a data access method, in which, during the process of migrating data from a source storage device to a target storage device, a client can access a copy of the source file in the target storage device through the file handle of the source file in the source storage device, so that the client does not need to apply for the file handle of the copy file from the target storage device to access the copy file in the target storage device. Therefore, there is no need for the client to restart the business, and the client does not need to shut down (i.e., zero downtime), thereby greatly reducing the cutover time, making the cutover time less than 1 minute, ensuring business continuity, or in other words, making the business continuity almost unaffected by data migration.
[0059] The source file refers to the file on the source storage device, and the copied file is obtained by copying the source file. Data migration involves copying the source file on the source storage device, obtaining the copied file, and then sending the copied file to the target storage device. File handles can also be referred to as handles.
[0060] Next, the data access method provided in the embodiment of the present application is introduced in detail.
[0061] FIG1 illustrates an architecture applicable to the data access method provided in an embodiment of the present application. The architecture may include a client 110, a target storage device 120, and at least one source storage device. The at least one source storage device may include a source storage device 130a and / or a storage device 130b. In the following description, when no specific distinction is made between source storage devices and target storage devices, they may be referred to simply as storage devices.
[0062] The client and the storage device, as well as different storage devices, may be connected via a network. In some embodiments, the network may be a wide area network (WAN), such as the Internet. In some embodiments, the network may be a local area network (LAN), such as an enterprise network.
[0063] Client 110 is a device or apparatus with data processing capabilities. In some embodiments, client 110 may be a physical computing device, such as a server or terminal. In some embodiments, client 110 may be a virtual computing device, such as a virtual machine (VM) or a container. The embodiments of this application do not specifically limit the specific implementation of client 110.
[0064] The client 110 may have one or more applications (APPs) installed. Each application corresponds to one or more services, such as rendering three-dimensional (3D) models, video editing, etc. The client 110 may execute the application program to perform the service corresponding to the application.
[0065] The client 110 can access data in the storage device to perform services. Specifically, taking the service of rendering a three-dimensional model as an example, the client 110 can read graphic data for model rendering from the storage device and perform model rendering based on the read graphic data.
[0066] The client 110 can access data in the storage device by sending a file access request to the storage device. The file access request is used to request to perform one or more operations on the file. The operation can be a read operation, a write operation, etc.
[0067] Client 110 can use one or more network protocols to access data in a storage device. In some embodiments, client 110 can access data in a storage device via the Network File System (NFS) protocol or the Server Message Block (SMB) protocol. In some embodiments, client 110 has multiple applications installed. When executing the services of one application, client 110 can access the storage device via the NFS protocol, while when executing the services of another application, client 110 can access the storage device via the NFS protocol or the SMB protocol.
[0068] A storage device is a device capable of storing data. It is equipped with a file system that can store and manage files and their metadata. File metadata, also known as file description information, describes a file's characteristics and attributes. This metadata can include information such as the file handle, file locking information, and the user to whom the file belongs.
[0069] In some embodiments, the storage device may specifically be a NAS device. The storage device may include multiple memories for storing data, such as disks. The multiple memories may be non-volatile memories. Exemplarily, the multiple memories may form a storage array. Data may be segmented and stored in two or more memories. When accessing the data, the two or more memories may be accessed concurrently, thereby improving data access efficiency. Exemplarily, the file system deployed on the storage device may be a distributed file system, which enables concurrent access to multiple memories.
[0070] In some embodiments, the storage device is deployed in the cloud. The cloud vendor can provide data storage services to one or more users through the storage device.
[0071] The source storage device is the source of data migration, which involves migrating data from the source storage device to another storage device. The target storage device is the destination of data migration, where the data from the source storage device is migrated to. In short, data migration involves moving data from the source storage device to the target storage device.
[0072] In some embodiments, through the data access method provided by the embodiments of the present application, data from multiple source storage devices can be migrated concurrently to the same target storage device, and data from the same source storage device can be migrated concurrently to multiple target storage devices, thereby improving data migration efficiency.
[0073] In some embodiments, the source storage device and the target storage device may belong to the same cloud vendor or different cloud vendors.
[0074] The data access method provided in the embodiment of the present application is mainly executed by the target storage device. Next, a possible software structure of the target storage device is introduced as an example.
[0075] Referring to Figure 2 , the target storage device 120 includes a migration engine and a migration control module. The migration engine is used to execute data migration tasks, i.e., to migrate data from the source storage device to the target storage device 120. The migration control module is used to control the migration engine to execute the migration task. For example, the migration control module can control the migration engine to start, pause, or terminate the migration task.
[0076] The target storage device 120 may include a front-end interface. The front-end interface is used for the client 110 to access the target storage device 120. Specifically, the front-end interface can receive a file access request sent by the client 110 for accessing files in the target storage device 120. The client 110 can send the file access request to the front-end interface in the form of a network message. The front-end interface can parse the network message to obtain the file access request. In some embodiments, the front-end interface may include multiple network protocol modules, such as an NFS protocol module and an SMB protocol module. Among them, the network protocol module is used to parse and adopt corresponding network messages to obtain file access requests. For example, it can be assumed that the client 110 adopts the NFS protocol and sends a file access request to the front-end interface, that is, the file access request is carried in the NFS protocol message. After the front-end interface receives the NFS protocol message, the NFS protocol module can parse the NFS protocol message to obtain the file access request.
[0077] The target storage device 120 also includes a handle mapping module, a file system, and a file request module. The handle mapping module can create a handle mapping list, forward data from the source storage device to the file system, and forward access requests from clients to the file system or unified client based on the handle mapping list. The details are as follows.
[0078] The migration engine sends the data migrated from the source storage device to the handle mapping module, wherein the data includes at least one file and the file handle of the source file of the file.
[0079] Among them, the file handle is the identifier of the file, and one file handle represents one file. The file handle of the file is different depending on the device where the file is located. More precisely, when a file is migrated or copied from a source storage device to a target storage device, the target storage device will allocate a new file handle for the file to identify the file in the target storage device. For the convenience of description, the file in the source storage device can be called the source file, and the file received by the target storage device can be called the copy file of the source file. Among them, the data migrated from the source storage device may include at least one copied file and the file handle of the source file of the at least one copied file. In addition, the copied file is a copy of the source file, and their contents are the same. The file handle of the source file can be understood as the identifier of the copied file in other storage devices before it is copied to the target storage device.
[0080] When a file is stored on a device, the operating system (OS) of the device assigns a file handle to the file to identify it. That is, when a copied file is stored on the target storage device 120, a file handle is assigned to it. The file handle assigned by the target storage device 120 to the copied file can be referred to as the file handle of the copied file. The handle mapping module can obtain the file handle of the copied file, then establish a correspondence between the file handle of the copied file and the file handle of the source file of the copied file, and record the correspondence in a handle mapping list. In some embodiments, the handle mapping list can be implemented as a table, which can be referred to as a handle mapping table.
[0081] The handle mapping module can cache the handle mapping list or store the handle mapping list persistently. For example, the handle mapping module can send the handle mapping list to the file system, and the file system can store the handle mapping list in the non-volatile memory of the target storage device 120.
[0082] The handle mapping module can also forward the copied file to the file system. The file system can store the copied file in the memory of the target storage device 120. In some embodiments, the target storage device 120 includes a storage array, and the file system can be a distributed file system. The file system can be used to divide the copied file into multiple segments and concurrently write the different segments to different memories in the storage array, thereby achieving efficient data writing.
[0083] The front-end interface can forward file access requests from the client to the handle mapping module. The file access request includes the file handle of the source file. Specifically, when the client 110 needs to access a file, it can carry the file handle of the file in the file access request. In the embodiment of the present application, the client 110 and the application on the client 110 do not need to be restarted. The file handle held by the client 110 is the file handle of the file in the source storage device, that is, the file handle of the source file. Therefore, the file handle carried in the file access request is the file handle of the source file.
[0084] The handle mapping module may obtain the file handle of the source file from the file access request, and search the handle mapping list for the file handle of the copy file corresponding to the file handle of the source file.
[0085] If the file handle of the copied file corresponding to the file handle of the source file is queried in the handle mapping list, it means that the copied file of the source file has reached the target storage device 120. At this time, the handle mapping list can forward the file access request and the file handle of the copied file to the file system. The file system can respond to the file access request and use the file handle of the copied file to perform the operation requested by the file access request on the copied file, thereby realizing the client 110's access to the file. For example, if the file access request is a read operation, the file system can read the copied file and send the read file to the client 110. The copied file, that is, the read file, is a copy of the file identified by the file handle in the file access request. Sending the read copied file to the client 110 is equivalent to sending the source file to the client 110, which satisfies the client 110's access to the file.
[0086] If the file handle of the copied file corresponding to the file handle of the source file is found in the handle mapping list, it means that the file requested by the file access request has not yet completed the migration from the source storage device to the target storage device 120. The handle mapping module can send the file access request or the file handle in the file access request to the file request module.
[0087] The file request module can send a copy request to the source storage device based on the file handle in the file access request. The copy request includes the file handle. The source storage device can respond to the copy request and send the copy file of the source file identified by the file handle to the target storage module 120. After receiving the copied file, the target storage device 120 can allocate a file handle for the copied file. The handle mapping module can establish a correspondence between the file handle of the copied file and the file handle in the file access request, and record the correspondence in the handle mapping list. The handle mapping module forwards the copied file to the file system to store the copied file in the memory of the target storage device 120. Then, the handle mapping list can forward the file access request and the file handle of the copied file to the file system. The file system can respond to the file access request and use the file handle of the copied file to perform the operation requested by the file access request on the copied file, thereby enabling the client 110 to access the file.
[0088] In some embodiments, the file request module can provide an application programming interface (API) to the handle mapping module, and the handle mapping module can call the API to send a file access request or a file handle to the file request module. The file request module can send a copy request to the source or target storage device in the form of a network message. In one example, the network message can be an NFS protocol message or an SMB protocol message.
[0089] In some embodiments, the file request module can also send a file access request to the source storage device so that the source storage device processes the file access request, that is, the source storage device responds to the file access request and accesses the file identified by the file handle in the file access request. Since the file identified by the file handle in the file access request is a file in the source storage device, the source storage device can respond to the file access request and access the file identified by the file handle in the file access request. In this way, when an abnormality occurs when the target storage device accesses the copied file stored in the target storage device (for example, the source storage device and the target storage device are incompatible, resulting in the target storage device being unable to normally access the data after the data in the source storage device is copied to the target storage device), the file access request can be forwarded to the source storage device so that the source storage device processes the file access request and accesses the source file, thereby meeting the client's demand for file access.
[0090] The above example introduces the software structure of the target storage device. Next, combining the above content, taking the target storage device 120, the source storage device 130a and the client 110 as an example, the execution process of the data access method provided by the embodiment of the present application is introduced.
[0091] Before migrating data, you can do some preparatory work.
[0092] In some embodiments, the preparation work may include configuring tenant information in the target storage device. The source storage device 130a may provide storage services for one or more tenants, and it is also hoped that the target storage device 120 will also provide storage services for the one or more tenants. Therefore, it is necessary to configure the tenant information in the target storage device.
[0093] 3 , the target storage device 120 may execute step 301 to obtain configuration information from the source storage device 130a. The configuration information may include tenant configuration information. In some embodiments, after the target storage device 120 and the source storage device 130a are connected, the target storage device 120 may automatically collect the configuration information, i.e., automatically execute step 301.
[0094] In some embodiments, tenant configuration information may include user information (such as the user's ID), user group information (such as the user group's ID), and shared object information (such as the shared object's ID), etc. Wherein, a tenant represents an organization, and members of the organization are called users. User information is the information of users in a tenant. A tenant is represented by a tenant account, and a user in a tenant refers to a user account under a tenant account, wherein the user information includes the user's account, the tenant to which the user belongs, and the mapping relationship between different user identifiers of the user. One or more users in a tenant can form a user group, and the user group information includes the users included in the user group.
[0095] Files in a storage device are owned by a tenant. More specifically, files are owned by a user within the tenant.
[0096] Shared users are users who are legally allowed to access a file. A file can be accessed by its shared users, but denied to users outside of it. When accessing a file, the file access request carries a user ID. The file system determines whether the user identified by the ID is a shared user for the file requested. If so, access is granted; otherwise, access is denied.
[0097] Continuing with Figure 3 , the target storage device 120 can execute step 302 to create a tenant account and a file subsystem belonging to the tenant account. Based on the tenant configuration information obtained in step 301, the target storage device 120 can create the tenant account in its file system and the user accounts under the tenant account. If one or more users belong to a user group, the target storage device 120 can create the user group and establish and record the affiliation between the users and the user group.
[0098] The target storage device 120 can create a file subsystem belonging to the tenant account in its file system. The file subsystem is used to store and manage the tenant's files. For example, when a file is received, it identifies which user in the tenant the file belongs to and records the ownership relationship between the file and the user.
[0099] The same user may have different user identifiers. For example, the user identifier of a user under the NFS protocol may be different from the user identifier of the user under the SMB protocol. Therefore, it is necessary to establish a user identifier mapping relationship between different user identifiers of the same user to indicate that these user identifiers represent the same user, thereby facilitating the file subsystem to determine whether the user is a shared object of the file and to store the file under the correct user account. The user identifier mapping relationship that the target storage device 120 can create is the same as the user identifier mapping relationship in the source storage device 130a. Exemplarily, as described above, the tenant configuration information includes a mapping relationship between different user identifiers of the user. The target storage device 120 can convert the mapping relationship between different user identifiers of the user in the tenant configuration information into a mapping relationship between different user identifiers of the user that is suitable for use and storage by the target storage device 120, thereby completing the creation.
[0100] In some embodiments, the file subsystem can be implemented as an external device file system (eDev FS). In some embodiments, the target storage device 120 can set the file subsystem's operating mode to a takeover priority mode. The takeover priority mode means that when both a file access request and a file to be stored are received, the file access request is prioritized, and then the file is stored, thereby ensuring that client services can be executed in a timely manner.
[0101] In some embodiments, the preparation work before data migration may also include configuring the storage environment. After the file is migrated from the source storage device to the target storage device 120, in order to ensure that the target storage device 120 can normally handle access to the file migrated from the source storage device 130a, the target storage device 120 may store the migrated file in a storage environment that is consistent with or close to the source storage device 130a. To this end, the configuration information obtained in step 301 may be environment configuration information. The environment configuration information is used to represent or describe the storage environment of the source storage device 130a. The storage environment may include one or any combination of a lightweight directory access protocol (LDAP) domain, a network information service (NIS) domain, and an active directory (AD) domain.
[0102] The target storage device 120 may execute step 304 to configure the storage environment based on the environment configuration information. In one example, the environment configuration information may include LDAP domain information. In step 304, the target storage device 120 may configure the LDAP domain of the target storage device 120 based on the LDAP domain information. In one example, the environment configuration information may include NIS domain information. In step 304, the target storage device 120 may configure the NIS domain of the target storage device 120 based on the NIS domain information. In one example, the environment configuration information may include AD domain information. In step 304, the target storage device 120 may configure the AD domain of the target storage device 120 based on the AD domain information.
[0103] In some embodiments, preparatory work before data migration may also include configuring a device address C1 for the target storage device. Device address C1, also known as the front-end address of target storage device 120, is the address used by the client to access target storage device 120. More specifically, target storage device 120 connects to the client network via device address C1, thereby receiving file access requests from the client and enabling access to the file. In one example, device address C1 may be an Internet Protocol (IP) address.
[0104] The device address C1 may be configured based on the device address C2 of the source storage device 130 .
[0105] The configuration information obtained in step 301 may include the device address C1 of the source storage device 130a. The device address C2 is the front-end address of the source storage device 130a and is used by the client to access the source storage device 130a.
[0106] The target storage device 120 executes step 303 and configures the device address C1 of the target storage device based on the device address C2 of the source storage device 130a. The device address C1 can be configured to be the same as the device address C2 of the source storage device 130. The device address C2 is the same as the device address C1. When switching the storage device connected to the client from the source storage device 130a to the target storage device 120, it is only necessary to deactivate the device address C2 and activate the device address C1. For the client, the device address to which it is connected remains unchanged, and there is no need to re-establish a network connection. That is, when switching storage devices, the client does not need to re-mount, thereby reducing the cutover time and further ensuring the continuity of the client's business execution. Before switching the storage device, the device address C1 is in a deactivated state and the device address C2 is in an activated state. The deactivated state is a non-use state and can be a prohibited state or a dormant state. A device address in a deactivated state cannot establish a network connection with the client. The activated state is a use state. A device address in an activated state can establish a network connection with the client.
[0107] The above methods can complete the preparation work before data migration. After that, you can start data migration.
[0108] The target storage device 120 executes step 305 to receive migration data from the source storage device 130a. Migration data refers to the data to be migrated; in other words, migration data refers to the data sent from the source storage device to the target storage device. The target storage device 120 can obtain the backend address of the source storage device 130a. The backend address of the source storage device is an address to which other storage devices (e.g., the target storage device 120) connect. The source storage device uses the backend address to send data to be migrated to the target storage device 120. In one example, the backend address may include multiple IP addresses, which form an IP list.
[0109] After obtaining the backend address of the source storage device 130a, the target storage device 120 can connect to the source storage device 130a through the backend address, thereby receiving data from the source storage device 130a.
[0110] Continuing to refer to FIG. 3 , the target storage device 306 may create a mapping list, wherein the mapping list includes a handle mapping list.
[0111] The migration data received in step 305 includes files and file handles. As described above, the files in the migration data (i.e., the files being migrated) are copies of the source files in source storage device 130a. After receiving the copies, target storage device 120 allocates file handles for the copies. In addition to the files being migrated, the migration data also includes handles. The file handles in the migration data are the file handles of the source files of the copies on source storage device 130a. That is, the files identified by the file handles in the migration data are the source files located on source storage device 130a.
[0112] In step 306, a correspondence between the file handle of the copied file and the file handle of the source file of the copied file is established, and the correspondence is recorded in a handle mapping list.
[0113] The copied file is a file copied or migrated from a source storage device to a target storage device, and the source file is a file located in the source storage device. The copied file is obtained by copying the source file.
[0114] The target storage device 120 can store the copied files in its file system. In some embodiments, the target storage device 120 can be deployed with multiple file systems, and the target storage device 120 can receive migration data from multiple source storage devices. Different file systems can be used to store files from different source storage devices respectively. For example, the file system D1 of the target storage device 120 is used to store files from the source storage device 130a, and the file system D2 of the target storage device 120 can be used to store files from the source storage device 130b. In step 306, the target storage device 120 can establish a correspondence between the file system and the source storage device, and record the correspondence in a file system mapping list. Specifically, the correspondence between the file system and the source storage device can be a correspondence between the file system identification (FSID) of the target storage device 120 and the file system identification of the source storage device. The migration data can also include the identification of the file system of the source storage device. When storing files in the migration data, the target storage device 120 can query the file system identifier corresponding to the file system identifier of the source storage device in the migration data in the file system mapping list, and store the file in the file system identified by the queried file system identifier, thereby improving file storage efficiency.
[0115] In some embodiments, the copied file may belong to a tenant, and the migration data may include an identifier for the tenant to which the copied file belongs. The target storage system 120 may hand the copied file over to the file subsystem corresponding to the tenant, which then stores and manages the copied file. In one example, the copied file may belong to a user within the tenant, and the file subsystem may store the copied file under the user account of the user to whom the copied file belongs. The tenant to which the copied file belongs is the tenant to which the source file of the copied file belongs, and the user to which the copied file belongs is the user to whom the source file belongs.
[0116] In some embodiments, the target storage device 120 can establish a correspondence between the directory where the copied file is located and the target location where the source file of the copied file is located, and record this correspondence in a directory mapping list. The migration data may include the directory where the source file of the copied file is located, and the target storage device 120 can determine which directory on the target storage device 120 the copied file is located. In this way, the target storage device 120 can establish a correspondence between the directory where the copied file is located and the target location where the source file of the copied file is located. The directory mapping list can improve file access efficiency, as will be described in detail below.
[0117] The handle mapping list, file system mapping list, and directory mapping list established above can be persistently stored. Specifically, the target storage device 12 stores the handle mapping list, file system mapping list, and directory mapping list in a non-volatile memory (such as a magnetic disk or solid-state drive).
[0118] In some embodiments, as described above, the target storage device 120 can obtain a file handle for a file on the source storage device 130a. The file handle for a file on the source storage device 130a is allocated by the source storage device 130a and may reflect certain information about the source storage device 130a, such as the manufacturer of the source storage device. Based on this information, the target storage device 120 can be further configured to reduce the risk of the target storage device 120 being incompatible with the data on the source storage device 130a.
[0119] In some embodiments, if the source file in the source storage device is in a locked state, the target storage device 120 can also set the copy of the file to a locked state. The owner of the access rights of the copy file in the locked state is consistent with the owner of the access rights of the source file in the locked state. A file in a locked state can deny applications other than the owner of the access rights to perform access operations on the file. The access operation is an access operation restricted by the access rights. Exemplarily, the access rights here include the right to modify, delete, and other operations on the file. That is, the file in the locked state receives the modification, deletion, and other operations of the owner of the access rights, but denies the modification, deletion, and other operations of other applications. The owner of the access rights of a file in a locked state may be the application that triggers the file to enter the locked state.
[0120] In this embodiment, the files migrated to the target storage device can be restored to the locked state in the source storage device, that is, the owner of the access rights of the files copied to the target storage device in the locked state is consistent with the owner of the source file when it is in the locked state, so there is no need to re-lock it, avoiding the time spent on re-locking and further ensuring business continuity.
[0121] The target storage device 120 can obtain the locking information of the source file. The locking information is information generated when the source file enters a locked state. The locking information includes the identifier of the owner of the access rights when the source file is in a locked state, and the identifier of the client where the owner is located. The locking information can indicate that the file refuses access operations such as modification operations and deletion operations from applications other than the owner included in the locking information. The owner included in the locking information refers to the owner identified by the owner identifier in the locking information. The target storage device 120 can set the copy of the source file to enter a locked state based on the locking information. The locked state entered by the copied file is consistent with the specific locking parameters of the locking state corresponding to the locking information. Specifically, the target storage device 120 sets the owner of the access rights of the copied file when it is in a locked state to the owner included in the locking information, so that the owner of the access rights of the copied file when it is in a locked state is consistent with the owner of the access rights of the source file when it is in a locked state.
[0122] The network protocols between the client and the storage device are different, and the way in which the target storage device 120 obtains the locking information is also different.
[0123] In one example, when the network protocol between the client and the storage device is the NFS protocol, the client can save the locking information of the lock state triggered by the application on the client. In this case, the target storage device 120 can obtain the locking information from the client. Specifically, the target storage device 120 can obtain the device information of the source storage device. Exemplarily, the target storage device 120 can obtain the device information of the source storage device through step 301. The device information is the information used by the user client to identify the device. In one example, the device information can be located in the device identifier. In the example given, the device information can be the address used by the device to connect to the client. After the network connection is established between the target storage device 120 and the client (details will be described below), the target storage device 120 can send the device information of the source storage device to the client, so that the client identifies the target storage device 120 as the source storage device, and thus sends the locking information to the source storage device identified by the client (actually the target storage device 120). In this way, the target storage device 120 can obtain the locking information.
[0124] In one example, when the network protocol between the client and the storage device is the SMB protocol, the storage device can store the locking information. In this case, the target storage device 120 obtains the locking information from the source storage device. Exemplarily, the target storage device 120 can obtain the device information of the source storage device through step 301.
[0125] The connection between the client 110 and the source storage device 130a can be disconnected, and at the same time, the client 110 is connected to the target storage device 120, so that the storage device connected to the client 110 is switched from the source storage device 130a to the target storage device 120. In some embodiments, this process can be implemented through step 307, as follows.
[0126] The target storage device 120 can execute step 307, and enable device address C1 while deactivating device address C2. Device address C2 is deactivated, the network connection between the client 110 and the source storage device 130a is disconnected, and device address C1 is enabled. When the client 110 restores the network connection, it connects to device address C1, thereby connecting to the target storage device 120. In this way, when switching storage devices, there is no need to re-establish the network connection. Only the network connection restoration operation is required to achieve the storage device switching. Compared with the network connection re-establishment operation, the network connection restoration operation saves operations such as exchanging handshake messages, and is less time-consuming. For the client 110, it is like a brief network fluctuation, and the business only needs to be briefly interrupted.
[0127] In step 306 , the source storage device 130 a may be manually triggered to disable the device address C2 , and the target storage device 120 may be manually triggered to enable the device address C1 .
[0128] In this way, the storage device connected to the client 110 can be switched from the source storage device 130 a to the target storage device 120 .
[0129] Continuing with FIG3 , after the client 110 is connected to the target storage device 120, the client 110 may execute step 308 and send a file access request B. Specifically, the file access request B2 may be a file access request generated and issued by an application on the client 110. The file access request B includes a file handle B1. The file handle B1 is a file handle in the source storage device 130a, meaning that the file identified by the file handle B1 is a source file located in the source storage device 130a. In other words, the file handle B1 is not a file handle allocated by the target storage device 120 for the file, and the file identified by the file handle B1 is not located in the target storage device 120.
[0130] Since the storage device connected to the client 110 has been switched to the target storage device 120, in step 308, the file access request B is sent to the target storage device 120. After receiving the file access request B, the target storage device 120 can execute step 309 to query the file handle corresponding to the file handle B1 in the handle mapping list. For the convenience of description, the file handle corresponding to the file handle B1 can be referred to as file handle B2. File handle B2 is the file handle of the copy file of the source file identified by file handle B1. That is, when the copy file of the source file identified by file handle B1 is sent to the target storage device 120, the target storage device 120 allocates the file handle for the copy file.
[0131] If the judgment result of step 309 is yes, that is, the file handle B2 is found in the handle mapping list, it means that the copy file of the source file identified by the file handle B1 has been migrated to the target storage device 120. In this way, the target storage device 120 can respond to the file access request B1, execute step 310, and access the file identified by the file handle B2. Among them, the file identified by the file handle B2 can also be called the target file identified by the file handle B2, which is a copy file of the source file identified by the file handle B1. Therefore, the access to the file identified by the file handle B2 is equivalent to the access to the source file identified by the file handle B1, and can also achieve the purpose of the client 110 sending a file access request.
[0132] In step 310, based on file handle B2, the file identified by file handle B2 can be searched in the files stored on the target storage device 120, thereby accessing the file identified by file handle B2. In some embodiments, file access request B also includes the directory where the source file identified by file handle B1 is located. The directory mapping list can be searched for the directory where the copy file corresponding to the directory where the source file identified by file handle B1 is located, and then the file identified by file handle B2 can be searched in the directory where the copy file is located, thereby quickly finding the file identified by file handle B2.
[0133] In some embodiments, the target storage device 120 can determine whether access to the file identified by file handle B2 is legal. That is, it can determine whether file access request B is a legal file access request. As described above, during data migration, the locking status can be synchronized. That is, if the source file is locked, the copied file migrated to the target storage device 120 also enters a locked state, and the locking status of the source file and the copied file are consistent. The target storage device 120 can detect whether the client that triggers the source file to enter the locked state and the client that sends file access request B are the same. Consistent clients refer to the same client identifier. The client identifier is information used to distinguish different clients, and different clients have different identifiers. The client that triggers the source file to enter the locked state refers to the client where the application that triggers the source file to enter the locked state resides. File access request B carries the identifier of the client that sends file access request B, namely, the identifier of client 110. As described above, the locking information obtained by the target storage device 120 includes the identifier of the client that triggers the file to enter the locked state. In this way, the target storage device 120 can obtain the identifier of the client that triggered the file identified by file handle B1 to enter a locked state, as well as the identifier of the client that sent file access request B. If the identifier of the client that triggered the file identified by file handle B1 to enter a locked state and the identifier of the client that sent file access request B are the same, it indicates that the client that triggered the file identified by file handle B1 to enter a locked state and the client that sent file access request B are the same. If the identifier of the client that triggered the file identified by file handle B1 to enter a locked state and the identifier of the client that sent file access request B are different, it indicates that the client that triggered the file identified by file handle B1 to enter a locked state and the client that sent file access request B are different. When the client that triggered the file identified by file handle B1 to enter a locked state and the client that sent file access request B are the same, the access to the file identified by file handle B2 is confirmed to be legal. That is, file access request B is a legal file access request. When the client that triggered the file identified by file handle B1 to enter a locked state and the client that sent file access request B are different, the access to the file identified by file handle B2 is confirmed to be illegal. That is, the file access request B may be an illegal file access request. When the access to the file identified by the file handle B2 is illegal, the target storage device 120 may not execute the access to the file identified by the file handle B2, thereby preventing the file from being illegally accessed and ensuring information security.
[0134] After accessing the file identified by file handle B2, target storage device 120 may execute step 317 and return an access result to client 110. For example, if file access request B1 is a read operation, target storage device 120 may return the read data to client 110 in step 317. If file access request B1 is a write operation, target storage device 120 may return write result information to client 110 in step 317. The write result information may indicate whether the data was written successfully. Examples of these steps are not listed here.
[0135] In some embodiments, the target storage device 120 may encounter an exception when accessing the target file identified by the file handle B2. In one example, the file system of the target storage device 120 and the file copied to the target storage device 120 are incompatible, resulting in the target storage device 120 being unable to access the target file identified by the file handle B2, thereby causing an exception. For example, the operation requested by the file access request B1 may be a read operation, and the target storage device 120 may not be able to read the contents of the target file identified by the file handle B2. For another example, the operation requested by the file access request B1 may be a write operation, and the target storage device 120 may not be able to write contents to the target file identified by the file handle B2. In one example, a failure may occur in the target storage device 120 that causes the target file identified by the file handle B2 to be inaccessible, thereby causing an exception.
[0136] In one example, when an abnormality occurs when the target storage device 120 accesses the target file identified by the file handle B2, the target storage device 120 can execute step 311 and send a file access request B to the source storage device 130a. When the source storage device 130a receives the file access request B, it can execute step 312 to access the file identified by the file handle B1. Since the file handle B1 is originally a file handle in the source storage device 130a, the file identified by the file handle B1 is located in the source storage device 130a. Therefore, when the source storage device 130a receives the file access request B, it can directly find the file identified by the file handle B1 based on the file handle B1, thereby achieving timely access to the file identified by the file handle B1, and the possibility of an access abnormality is low. Therefore, when an abnormality occurs when the target storage device 120 accesses the file, business continuity can be guaranteed.
[0137] After the source storage device 130a accesses the file identified by the file handle B1, the source storage device 130a may send the access result to the target storage device 120 in step 313. Upon receiving the access result, the target storage device 120 may send the access result to the client 110 in step 317.
[0138] In one example, when an abnormality occurs during target storage device 120's access to the target file identified by file handle B2, target storage device 120 deactivates device address C1, and source storage device 130a reactivates device address C2, causing the storage device connected to client 110 to switch from target storage device 120 to source storage device 130a. Thus, client 110 can continue to execute services by accessing source storage device 130a, ensuring business continuity. Furthermore, the file handle in the file access request sent by client 110 is itself a file handle in source storage device 130a, and the file identified by the file handle is located in source storage device 130a. Therefore, upon receiving the file access request, source storage device 130a can directly locate the file identified by the file handle based on the file handle, achieving timely access to the file identified by the file handle, and reducing the likelihood of an access abnormality. This ensures business continuity when an abnormality occurs during target storage device 120's access to a file.
[0139] In one example, if other failures occur on the target storage device 120, causing it to be unable to properly process file access requests from the client. For example, if the hardware of the target storage device 120 fails or the operating system experiences an anomaly, causing the target storage device 120 to be unable to parse the file access request or recognize the file handle, the target storage device 120 deactivates the device address C1, and the source storage device 130a reactivates the device address C2, so that the storage device connected to the client 110 is switched from the target storage device 120 to the source storage device 130a. As a result, the client 110 can continue to perform services by accessing the source storage device 130a, ensuring business continuity.
[0140] In one example, when the target storage device 120 fails, the target storage device 120 may issue an alarm. Upon detecting the alarm, maintenance personnel or other personnel may trigger the target storage device 120 to disable the device address C1 and trigger the source storage device 130a to re-enable the device address C2.
[0141] In some embodiments, even after all the data that needs to be migrated in the source storage device has been copied to the target storage device 120, the source storage device will still save the data and maintain the connection to the target storage device. When the target storage device 120 has been running for a certain period of time and no abnormalities (such as file access abnormalities) have occurred, the operation and maintenance personnel can confirm that the target storage device 120 can completely take over the source storage device. At this time, the operation and maintenance personnel can instruct the target storage device 120 or the source storage device to disconnect the connection between the target storage device 120 and the source storage device. For example, the operation and maintenance personnel can instruct the source storage device to delete data, such as formatting the memory, to consume data and ensure information security.
[0142] In some embodiments, if the judgment result of step 309 is no, that is, the file handle B2 is not found in the handle mapping list, it means that the copy file of the source file identified by the file handle B1 has not yet been migrated to the target storage device 120. In this case, the target storage device 120 can execute step 314 to send a copy request to the source storage device 130a. When there are multiple source storage devices, in step 314, a copy request can be sent to each source storage device. The copy request includes the file handle B1. Which source storage device the file handle B1 belongs to (that is, which source storage device the file handle B1 is allocated by) determines which source storage device the file identified by the file handle B1 is located in. The file handle B1 can be set to belong to the source storage device 130a, and the source storage device 130a can query the file identified by the file handle B1 based on the file handle B1, and send the copy file of the file identified by the file handle B1 to the target storage device 120 through step 315. The source storage device 130a does not need to send the copy of the file identified by the file handle B1 to the target storage device 120 according to the default data migration order. In other words, the source storage device 130a can prioritize sending the copy of the file identified by the file handle B1 to the target storage device 120. Then, it can continue to send the migrated data to the target storage device 120 according to the default data migration order.
[0143] After receiving the copy of the file identified by file handle B1, the target storage device 120 may allocate a file handle to the copy, which is file handle B2. A correspondence between file handle B2 and file handle B1 is then established, and step 316 is executed to access the copy of the file identified by file handle B1, i.e., the file identified by file handle B2.
[0144] After accessing the file identified by the file handle B2, the target storage device 120 may execute step 317 to return the access result to the client 110. For details, please refer to the above description and will not be repeated here.
[0145] In the data access method provided in the embodiment of the present application, the client can access the file copy of the file in the target storage device through the file handle of the file in the source storage device, without restarting the client or the application on the client. That is, the client can access the file in the target storage device when the downtime of the client or application is zero, which greatly reduces the cutover time and ensures the continuity of business data.
[0146] The data access method provided in this embodiment of the present application can achieve downtime as shown in Figure 4. This downtime refers to the downtime of the client or application. As can be seen, in the data access method provided in this embodiment of the present application, the downtime of the client or application is zero, thereby significantly reducing the cutover time and ensuring the continuity of business data.
[0147] Based on the data access method described above, the present application provides another data access method. It is understandable that this method is another way of expressing the data access method described above, and the two are combined. Part or all of the content of this method can be found in the description of the data access method above.
[0148] The method may be executed by a target storage device, wherein the target storage device may be a target storage device in a data migration scenario, such as the target storage device 120. Referring to FIG5 , the method includes the following steps.
[0149] In step 501, a target storage device receives a file access request from a client, the file access request including a first handle, wherein the source file identified by the first handle is not located on the target storage device. For details, please refer to the above description of step 308 in FIG. 3 and will not be repeated here.
[0150] In step 503, the target storage device searches the handle mapping list for the second handle corresponding to the first handle and accesses the target file identified by the second handle, which is located on the target storage device. For details, please refer to the above description of steps 309-310 in Figure 3 and will not be repeated here.
[0151] In some embodiments, the first handle is an identifier of the target file in another storage device before the target file is copied to the target storage device. Detailed implementation can be found in the above description of the file handle B1.
[0152] In some embodiments, the method further includes: when an exception occurs in accessing the target file, the target storage device forwarding the access request to the source storage device where the source file is located to access the source file. For details, please refer to the above description of steps 311-313 in Figure 3, which will not be repeated here.
[0153] In some embodiments, the device address of the target storage device is the same as the device address of the source storage device where the source file is located, and the device address is used for access by the client. Before the target storage device receives the file access request, the method further includes: enabling the device address of the target storage device; and disabling the device address of the source storage device. For details, please refer to the above description of step 307 in Figure 3 and will not be repeated here.
[0154] In an example of this embodiment, when the target storage device fails, the method further includes: disabling the device address of the target storage device; and re-enabling the device address of the source storage device.
[0155] In another example of this embodiment, the method further includes: when an exception occurs in access to the target file, the target storage device deactivates the device address of the target storage device; and re-enables the device address of the source storage device.
[0156] In some embodiments, the method further includes: when the second handle does not exist in the handle mapping list, sending a copy request to the source storage device where the source file is located, the copy request including the first handle, the copy request being used to request the source storage device to copy the source file to the target storage device. For details, please refer to the above description of steps 314-316 in Figure 3 and will not be repeated here.
[0157] In some embodiments, the source file identified by the first handle and located in the source storage device is in a locked state, and the method further includes: the target storage device setting the target file identified by the second handle to a locked state, wherein the owner of the access rights of the locked target file is consistent with the owner of the access rights of the locked source file. For details, please refer to the above description of the locked state of the source file identified by file handle B1 and the locked state of the target file identified by file handle B1, which will not be repeated here.
[0158] In an example of this embodiment, the target storage device sets the target file to a locked state, including: the target storage device obtains locking information generated when the source file enters a locked state; the target storage device sets the target file to a locked state based on the locking information.
[0159] In an example of this embodiment, the method further includes: when it is detected that the client that triggers the source file to enter the locked state is the same as the client that sends the access request, confirming that the access to the target file is legal.
[0160] In the data access method provided in the embodiment of the present application, the client can access the file copy of the file in the target storage device through the file handle of the file in the source storage device, without restarting the client or the application on the client. That is, the client can access the file in the target storage device when the downtime of the client or application is zero, which greatly reduces the cutover time and ensures the continuity of business data.
[0161] 6 , an embodiment of the present application further provides a data access apparatus 600 . The apparatus 600 may be configured in a target storage device, for example, the target storage device 120 .
[0162] As shown in FIG6 , the apparatus 600 includes:
[0163] The receiving unit 610 is configured to receive a file access request sent by a client, wherein the file access request includes a first handle, wherein the source file identified by the first handle is not located in the target storage device;
[0164] The access unit 620 is configured to query a second handle corresponding to the first handle in a handle mapping list, and access a target file identified by the second handle, where the target file is located in the target storage device.
[0165] The functions of the functional units of the apparatus 600 may be implemented with reference to the above description of the method embodiments shown in FIG. 5 or FIG. 3 , and will not be described in detail here.
[0166] An embodiment of the present application provides a computing device 700. As shown in FIG7 , computing device 700 includes a processor 710 and a memory 720. Memory 720 is used to store files and executable programs. Processor 710 is configured to execute the executable program stored in memory 720, enabling computing device 700 to perform the operations performed by target storage device 120 in the embodiment shown in FIG3 above, or the data access method shown in FIG5 .
[0167] The present application also provides a computer program product comprising instructions. The computer program product may be software or a program product comprising instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on a computing device, the computing device executes the method shown in FIG5 .
[0168] The present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center that contains one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to execute the method shown in Figure 5.
[0169] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the protection scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A data access method, characterized in that: The method comprises: The target storage device receives a file access request sent by a client, where the file access request includes a first handle, wherein the source file identified by the first handle is not located in the target storage device; The target storage device searches for a second handle corresponding to the first handle in a handle mapping list, and accesses a target file identified by the second handle, where the target file is located in the target storage device.
2. The data access method according to claim 1, wherein: The first handle is an identifier of the target file in other storage devices before the target file is copied to the target storage device.
3. The method according to claim 1 or 2, characterized in that The method further comprises: When an exception occurs in access to the target file, the target storage device forwards the access request to the source storage device where the source file is located, so as to access the source file.
4. The method according to claim 1 or 2, characterized in that The device address of the target storage device is the same as the device address of the source storage device where the source file is located, and the device address is used for access by the client. Before the target storage device receives the file access request, the method further includes: Enable the device address of the target storage device; Deactivate the device address of the source storage device.
5. The method according to claim 4, characterized in that When the target storage device fails, the method further includes: Deactivating the device address of the target storage device; Re-enable the device address of the source storage device.
6. The method according to claim 4, characterized in that The method further comprises: When an exception occurs in access to the target file, the target storage device deactivates the device address of the target storage device; Re-enable the device address of the source storage device.
7. The method according to any one of claims 1 to 4, characterized in that The method further comprises: When the second handle does not exist in the handle mapping list, a copy request is sent to the source storage device where the source file is located, the copy request including the first handle, and the copy request is used to request the source storage device to copy the source file to the target storage device.
8. The method according to any one of claims 1 to 4, characterized in that The source file identified by the first handle and located in the source storage device is in a locked state, and the method further includes: The target storage device sets the target file identified by the second handle to a locked state, wherein an owner of access rights of the locked target file is consistent with an owner of access rights of the locked source file.
9. The method according to claim 8, characterized in that The target storage device setting the target file to a locked state includes: The target storage device obtains locking information generated when the source file enters a locked state; The target storage device sets the target file to a locked state based on the locking information.
10. The method according to claim 8 or 9, characterized in that The method further includes: when it is detected that the client that triggers the source file to enter the locked state is the same as the client that sends the access request, confirming that the access to the target file is legal.
11. A data access device, characterized in that: Configured on a target storage device, the apparatus includes: a receiving unit, configured to receive a file access request sent by a client, wherein the file access request includes a first handle, wherein a source file identified by the first handle is not located in the target storage device; The access unit is configured to query a second handle corresponding to the first handle in a handle mapping list, and access a target file identified by the second handle, where the target file is located in the target storage device.
12. The device according to claim 11, characterized in that The device further comprises: The sending unit is configured to forward the access request to the source storage device where the source file is located when an exception occurs in access to the target file, so as to access the source file.
13. The device according to claim 11, characterized in that The device address of the target storage device is the same as the device address of the source storage device where the source file is located, and the device address is used for access by the client. The apparatus further includes: An enabling unit, configured to enable the device address of the target storage device.
14. The device according to claim 13, characterized in that The apparatus further includes a deactivation unit configured to deactivate the device address of the target storage device when a failure occurs in the target storage device.
15. The device according to claim 13, characterized in that The device further comprises: A deactivation unit is used to deactivate the device address of the target storage device when an abnormality occurs in access to the target file.
16. The device according to any one of claims 11 to 13, characterized in that The device further comprises: A sending unit is used to send a copy request to the source storage device where the source file is located when the second handle does not exist in the handle mapping list. The copy request includes the first handle and is used to request the source storage device to copy the source file to the target storage device.
17. The device according to any one of claims 11 to 13, characterized in that The source file identified by the first handle and located in the source storage device is in a locked state, and the apparatus further comprises: The setting unit is configured to set the target file identified by the second handle to be in a locked state, wherein an owner of access rights of the target file in the locked state is consistent with an owner of access rights of the source file in the locked state.
18. A computing device, characterized in that include: a memory for storing executable programs; A processor, configured to execute the method according to any one of claims 1 to 10 by running the executable program.
19. A computer-readable storage medium, characterized in that The method comprises computer program instructions, which, when executed by a computing device, causes the computing device to perform the method according to any one of claims 1 to 10.
20. A computer program product comprising instructions, characterized in that When the instructions are executed by a computer device, the computer device is caused to perform the method according to any one of claims 1 to 10.