Data reading method, electronic equipment, storage medium and program product
By synchronizing data between production volumes and disaster recovery volumes, the problem of data unreadable due to media errors in production volumes was resolved. This enabled data to be read from the disaster recovery volume and the error to be repaired when media errors occur, ensuring business continuity.
Patent Information
- Application Number
- CN202511358506.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-23
- Publication Date
- 2025-10-28
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, when a media error occurs in a production volume, the host cannot read the data, affecting business continuity.
By receiving read requests from the host, the system determines the data synchronization status between the production volume and the disaster recovery volume. If they are synchronized, the system reads data from the disaster recovery volume and returns it to the host to repair the media error area.
When a media error occurs on a production volume, data can be read from the disaster recovery volume and returned to the host, reducing the impact on host services and improving data availability.
Smart Images

Figure CN120848816A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of remote copying technology, and in particular to a data reading method, electronic device, storage medium, and program product. Background Technology
[0002] Remote replication is an important disaster recovery technology. Remote replication refers to establishing a replication relationship between volumes from two clusters. One volume is called the production volume, which provides read services to the outside world. The other volume is called the disaster recovery volume. The production volume synchronizes data to the disaster recovery volume. However, in related technologies, the production volume may experience media errors, causing the host to be unable to read the required data, thus affecting host operations. Therefore, how to solve the above-mentioned technical defects has become a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0003] This invention provides a data reading method, electronic device, storage medium, and program product to at least solve the problem in related technologies where production volumes fail to read data due to media errors, thus affecting host services.
[0004] This invention provides a data reading method, including: Receive read requests from the host and read the corresponding data from the production volume according to the read requests; If the read result indicates a media error in the production volume, then based on the remote replication bitmap, it is determined whether the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume. If the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume, then a request is sent to the disaster recovery volume to read the data corresponding to the read request from the disaster recovery volume; Receive the data corresponding to the read request returned by the disaster recovery volume, and return the data corresponding to the read request to the host.
[0005] The present invention also provides a data reading device, comprising: The receiving module is used to receive read requests issued by the host and read the corresponding data from the production volume according to the read requests; The judgment module is used to determine, based on the remote replication bitmap, whether the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume if the read result indicates that a media error has occurred in the production volume; The sending module is configured to send a request to the disaster recovery volume to read the data corresponding to the read request from the disaster recovery volume if the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume. The response module is used to receive the data corresponding to the read request returned by the disaster recovery volume, and return the data corresponding to the read request to the host.
[0006] The present invention also provides an electronic device, comprising: a memory for storing a computer program; and a processor for executing the computer program to implement the steps of any of the above-described data reading methods.
[0007] The present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the above-described data reading methods.
[0008] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of any of the above-described data reading methods.
[0009] The beneficial effect is that when the production volume has a media error and cannot read the required data from the production volume, the production volume sends a request to the disaster recovery volume to read the required data from the disaster recovery volume, and returns the data returned by the disaster recovery volume to the host. Thus, when the production volume has a media error, the required data can be read from the disaster recovery volume and returned to the host, reducing the impact of the production volume having a media error on the host's services. Attached Figure Description
[0010] To more clearly illustrate the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 A flowchart illustrating a data reading method provided in an embodiment of the present invention; Figure 2 This is a schematic diagram illustrating remote data replication differences provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of a specific data reading process provided in an embodiment of the present invention; Figure 4 A schematic diagram of a data reading device provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0012] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the present invention.
[0013] It should be noted that, in the description of this invention, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., used in this invention are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0014] To enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0015] The embodiments of the present invention provide a data reading method. The method is described in detail below in conjunction with the execution flow of the data reading method.
[0016] refer to Figure 1 As shown, an embodiment of the present invention provides a data reading method including: S101: Receive a read request from the host and read the corresponding data from the production volume according to the read request; S102: If the read result indicates that a media error has occurred on the production volume, then based on the remote replication bitmap, determine whether the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume; S103: If the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume, then send a request to the disaster recovery volume to read the data corresponding to the read request from the disaster recovery volume; S104: Receive the data corresponding to the read request returned by the disaster recovery volume, and return the data corresponding to the read request to the host.
[0017] In this embodiment of the invention, the executing entity is the remote copy function module for production volumes. The remote copy function module refers to the function module responsible for remote copy-related operations.
[0018] Establish a remote replication relationship between the production volume and the disaster recovery volume.
[0019] In some embodiments, the remote replication relationship between the production volume and the disaster recovery volume is a synchronous remote replication relationship.
[0020] Synchronous remote replication refers to the process where, when the host writes data to the production volume, the production volume immediately synchronizes the data to the disaster recovery volume. Once both the production and disaster recovery volumes have completed the write operation, the production volume responds to the host. Synchronous remote replication ensures that the data on the production and disaster recovery volumes is identical in real time, potentially resulting in a Recovery Point Objective (RPO) of 0.
[0021] The production volume is mapped to the host and undertakes business operations. When the host issues a read request to the production volume, the remote replication module in the production volume forwards the read request to the storage backend of the production volume. The storage backend of the production volume reads data of the specified location and length from the hard disk according to the logical block address and data length in the read request, and returns the read result. The remote replication module receives the read result returned by the storage backend, and when the read result indicates that a media error has occurred in the production volume, it determines whether the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume according to the remote replication bitmap. The remote replication bitmap is used to record the data differences between the production volume and the disaster recovery volume. If the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume, the remote replication module generates a request based on the logical block address and data length in the read request and sends it to the disaster recovery volume, so that the disaster recovery volume can read the corresponding data according to the received request and return it to the production volume. The remote replication module receives the data corresponding to the read request returned by the disaster recovery volume and returns the data corresponding to the read request to the host.
[0022] In some embodiments, determining whether the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume based on the remote replication bitmap includes: Based on the logical block address and data length in the read request, check the corresponding bit in the remote copy bitmap; If the bit is the first value, then the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume; If the bit is the second value, then the data corresponding to the read request has not been synchronized between the production volume and the disaster recovery volume.
[0023] In the remote replication bitmap, one bit corresponds to a logical block space of a certain size. For example, one bit corresponds to a 256KB logical block space. If the data in a logical block of the production volume and the disaster recovery volume are the same, the corresponding bit in the remote replication bitmap is set to the first value. If the data in a logical block of the production volume and the disaster recovery volume are different, the corresponding bit in the remote replication bitmap is set to the second value. The first value can be 0, and the second value can be 1. Therefore, if the data in a logical block of the production volume and the disaster recovery volume are the same, the corresponding bit in the remote replication bitmap is set to 0. If the data in a logical block of the production volume and the disaster recovery volume are different, the corresponding bit in the remote replication bitmap is set to 1.
[0024] For example, refer to Figure 2 As shown, at time 0:00, the data of each logical block in the production volume and the disaster recovery volume is the same, and the value of each bit in the remote replication bitmap is 0. At time 01:00, the data of some logical blocks in the production volume and the disaster recovery volume are different, and the value of the bit corresponding to that part of the logical block in the remote replication bitmap is 1. Figure 2 The bitmap in this context refers to a remotely copied bitmap.
[0025] When a read result indicates a media error on the production volume, the corresponding bit in the remote replication bitmap is checked based on the logical block address and data length in the read request. If the bit is the first value, the data corresponding to the read request has been synchronized between the production and disaster recovery volumes; that is, the data of the logical block with the media error has been synchronized between the production and disaster recovery volumes. If the bit is the second value, the data corresponding to the read request has not been synchronized between the production and disaster recovery volumes; that is, the data of the logical block with the media error has not been synchronized between the production and disaster recovery volumes.
[0026] For example, if the bit is 0, it indicates whether the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume. If the bit is 1, it indicates whether the data corresponding to the read request has not been synchronized between the production volume and the disaster recovery volume.
[0027] In some embodiments, it also includes: A write request is generated based on the data corresponding to the read request returned by the disaster recovery volume; the write request carries the data returned by the disaster recovery volume. The write request is sent to the storage backend of the production volume so that the storage backend writes the data carried by the write request into the media error area of the storage backend.
[0028] After receiving the data corresponding to the read request returned by the disaster recovery volume, the remote replication module, in addition to returning the data to the host, also uses the data to rewrite the media-faulted area to repair the media error. Specifically, the remote replication function generates a write request based on the data from the read request returned by the disaster recovery volume; the write request carries the data from the read request. The remote replication module then sends the write request to the storage backend of the production volume, causing the backend storage of the production volume to write the data carried by the write request to the media-faulted area on the hard drive.
[0029] This embodiment uses data returned from the disaster recovery volume to rewrite the media error area, repairing the media errors in the production volume and improving the availability of the production volume.
[0030] In some embodiments, it also includes: Receive the write result returned by the storage backend; If the write result indicates a write failure, an alarm message is reported to indicate that an irreparable media error has occurred on the production volume of the target object.
[0031] The remote replication function generates write requests based on the data corresponding to the read requests returned by the disaster recovery volume; the write requests carry the data corresponding to the read requests. The remote replication module sends the write requests to the storage backend of the production volume, enabling the backend storage to write the data carried by the write requests to the area of the hard drive with the media error. The remote replication module receives the write result returned by the backend storage. If the write result indicates a write failure, the media error is determined to be an unrecoverable media error, possibly due to hardware damage. In this case, the write operation is not retried; instead, an alarm message is directly reported to inform the target object (user) that the production volume has an unrecoverable media error, and it is recommended that the target object replace the hard drive to resolve the media error issue.
[0032] In some embodiments, returning the data corresponding to the read request to the host takes precedence over generating a write request based on the data corresponding to the read request returned by the disaster recovery volume.
[0033] The remote replication module receives the data corresponding to the read request from the disaster recovery volume and first returns this data to the host. Then, based on the data from the read request, the remote replication module generates a write request; the write request carries the data from the read request. The remote replication module then sends the write request to the storage backend of the production volume, causing the backend storage of the production volume to write the data carried by the write request to the area on the hard drive where the media is faulty.
[0034] In this embodiment, the response host takes priority over the area with the rewrite media error. This enables a fast response host and minimizes the impact of media errors on host services.
[0035] In some embodiments, it also includes: If the read result returned by the disaster recovery volume indicates a read failure, then information indicating a media error has occurred on the production volume is returned to the host.
[0036] The remote replication module receives the read results returned by the disaster recovery volume. If the disaster recovery volume returns a read result indicating a read failure, the remote replication module returns information to the host indicating a media error on the production volume. For example, the remote replication module returns a Medium Error to the host.
[0037] In some embodiments, it also includes: If the read result returned by the disaster recovery volume indicates a read timeout, then a new request is sent to the disaster recovery volume to reread the data corresponding to the read request from the disaster recovery volume. If the read results returned by the disaster recovery volume for a preset number of consecutive times all indicate read timeout, then information indicating that the production volume has a media error is returned to the host.
[0038] The remote replication module receives the read results returned by the disaster recovery volume. If the read result returned by the disaster recovery volume indicates a read timeout, the module resends the request to the disaster recovery volume to reread the data corresponding to the read request. If the disaster recovery volume returns read timeout results after each request is sent a preset number of times, the module returns information indicating a media error in the production volume to the host.
[0039] For example, the remote replication module receives the read result returned by the disaster recovery volume. If the read result returned by the disaster recovery volume indicates a read timeout, the module resends the request to the disaster recovery volume to reread the data corresponding to the read request. If the disaster recovery volume returns a read timeout after each of the three consecutive requests, the module returns a message to the host indicating a media error in the production volume.
[0040] In some embodiments, it also includes: If the data corresponding to the read request has not been synchronized between the production volume and the disaster recovery volume, then information indicating a media error in the production volume is returned to the host.
[0041] If the data corresponding to the read request has not been synchronized between the production volume and the disaster recovery volume, indicating that the corresponding data on the disaster recovery volume is old data and unusable, then a message indicating that a media error has occurred on the production volume is returned to the host.
[0042] In some embodiments, it also includes: If the data corresponding to the read request is not synchronized between the production volume and the disaster recovery volume, an alarm message will be reported to indicate that the target object data read failed.
[0043] If the data corresponding to the read request has not been synchronized between the production volume and the disaster recovery volume, it indicates that the corresponding data on the disaster recovery volume is old data and cannot be used. An alarm message will be reported to notify the target object that the data read has failed, so that the target object can take necessary measures to reduce the impact on the host business.
[0044] In some embodiments, it also includes: If the data corresponding to the read request has not been synchronized between the production volume and the disaster recovery volume, a request is sent to the standby disaster recovery volume to read the data corresponding to the read request from the standby disaster recovery volume.
[0045] In this embodiment, the disaster recovery volume includes a primary disaster recovery volume (the disaster recovery volume described above is the primary disaster recovery volume) and a standby disaster recovery volume. The production volume synchronizes data to the primary and standby disaster recovery volumes. If the data corresponding to a read request has not been synchronized between the production and primary disaster recovery volumes, a request is sent to the standby disaster recovery volume to read the data corresponding to the read request from the standby disaster recovery volume.
[0046] In some embodiments, it also includes: If data is successfully read from the backup disaster recovery volume, the data read from the backup disaster recovery volume is written into the disaster recovery volume, and the data read from the backup disaster recovery volume is used to overwrite the media error area of the production volume.
[0047] If the data corresponding to the read request is successfully read from the standby disaster recovery volume, the remote replication module writes the data returned by the standby disaster recovery volume to the corresponding location on the primary disaster recovery volume, and uses the data returned by the standby disaster recovery volume to overwrite the media error area on the production volume. This not only repairs the media error on the production volume, but also synchronizes data between the production volume, the primary disaster recovery volume, and the standby disaster recovery volume.
[0048] If the backup disaster recovery volume returns a read result indicating a read failure, the remote replication module returns information to the host indicating a media error on the production volume. If the backup disaster recovery volume returns a read result indicating a read timeout, the request is resent to the backup disaster recovery volume to reread the data corresponding to the read request. If a preset number of requests are sent to the backup disaster recovery volume, and the backup disaster recovery volume returns a read timeout result after each request, the module returns information to the host indicating a media error on the production volume.
[0049] Combination Figure 3 As shown, the following describes a specific implementation method: A volume (referred to as Volume A) in the first cluster (referred to as Cluster A) is used as the production volume, and a volume (referred to as Volume B) in the second cluster (referred to as Cluster B) is used as the disaster recovery volume. A synchronous remote replication relationship is established between the production volume and the disaster recovery volume. The production volume is mapped to a host to handle business operations.
[0050] The host sends a read request to the production volume, and the production volume's remote replication module forwards the read request to the production volume's storage backend. The production volume's storage backend reads data from the hard drive at the specified location and length based on the logical block address and data length in the read request, and returns the read result. The remote replication module receives the read result returned by the storage backend. If the data corresponding to the read request is found, the remote replication module returns the read data to the host. If the read result indicates a media error on the production volume, the remote replication bitmap is used to determine whether the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume. If the corresponding bit in the remote replication bitmap is 0, the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume; that is, the data of the logical block with the media error has been synchronized between the production volume and the disaster recovery volume. If the bit is 1, the data corresponding to the read request has not been synchronized between the production volume and the disaster recovery volume; that is, the data of the logical block with the media error has not been synchronized between the production volume and the disaster recovery volume.
[0051] If the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume, the remote replication module generates a request based on the logical block address and data length in the read request and sends it to the disaster recovery volume, so that the disaster recovery volume can read the corresponding data according to the received request and return it to the production volume.
[0052] In cluster B, after receiving a request from cluster A, the disaster recovery volume parses the request to determine whether it is a write request or a read request. If it is a write request, it writes the data to the corresponding location in the disaster recovery volume according to the request, and then returns the write result to cluster A. If it is a read request, it reads the data from the corresponding location in the disaster recovery volume according to the request, and then returns the read result to cluster A.
[0053] In cluster A, the remote replication module of the production volume receives the read result returned by cluster B. If the read result is successful, indicating that the data corresponding to the read request has been successfully read from the disaster recovery volume, the data returned by the disaster recovery volume is sent back to the host. If the read result returned by the disaster recovery volume indicates a read failure, the remote replication module returns information to the host indicating a media error in the production volume. If the read result returned by the disaster recovery volume indicates a read timeout, the request is resent to the disaster recovery volume to reread the data corresponding to the read request. If a preset number of requests are sent to the disaster recovery volume, and the read result returned by the disaster recovery volume after each request indicates a read timeout, the module returns information to the host indicating a media error in the production volume.
[0054] The remote replication module receives the data corresponding to the read request from the disaster recovery volume and first returns this data to the host. Then, based on the data from the read request, the remote replication module generates a write request; the write request carries the data from the read request. The remote replication module then sends the write request to the storage backend of the production volume, causing the backend storage of the production volume to write the data carried by the write request to the area on the hard drive where the media is faulty.
[0055] If writing to the media error area of the production volume fails, the media error is determined to be unrecoverable, potentially indicating hardware damage. In this case, the write operation is not retried; instead, an alarm message is directly reported to inform the target user that the production volume has an unrecoverable media error, and it is recommended that the target user replace the hard drive to resolve the media error issue.
[0056] It should be noted that the data reading method provided in the above embodiments of the present invention can be applied not only to synchronous remote replication scenarios but also to asynchronous remote replication scenarios. Asynchronous remote replication refers to a scenario where, after the host writes data to the production volume, the production volume immediately responds to the host, and then a background task periodically synchronizes the incremental data from the production volume to the disaster recovery volume. The Recovery Point Objective (RPO) depends on the set background task period.
[0057] In summary, the data reading method provided by this invention enables the production volume to send a request to the disaster recovery volume to read the required data when the production volume experiences a media error and cannot read the required data. The disaster recovery volume then returns the data to the host, thereby enabling the production volume to read the required data from the disaster recovery volume and return it to the host when the production volume experiences a media error, thus reducing the impact of the production volume's media error on the host's services.
[0058] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.
[0059] Embodiments of the present invention also provide a data reading device, see reference. Figure 4 As shown, the data reading device includes: The receiving module 10 is used to receive a read request issued by the host and read the corresponding data from the production volume according to the read request; The judgment module 20 is used to determine, based on the remote replication bitmap, whether the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume if the read result indicates that a media error has occurred in the production volume; The sending module 30 is configured to send a request to the disaster recovery volume to read the data corresponding to the read request from the disaster recovery volume if the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume. The response module 40 is used to receive the data corresponding to the read request returned by the disaster recovery volume, and return the data corresponding to the read request to the host.
[0060] When the host sends a read request to the production volume, the receiving module 10 forwards the read request to the storage backend of the production volume. The storage backend of the production volume reads data of the specified location and length from the hard disk according to the logical block address and data length in the read request, and returns the read result. The receiving module 10 receives the read result returned by the storage backend, and when the read result indicates a media error in the production volume, the judging module 20 determines whether the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume based on the remote replication bitmap. The remote replication bitmap is used to record data differences between the production volume and the disaster recovery volume. If the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume, the sending module 30 generates a request based on the logical block address and data length in the read request and sends it to the disaster recovery volume, so that the disaster recovery volume reads the corresponding data according to the received request and returns it to the production volume. The response module 40 receives the data corresponding to the read request returned by the disaster recovery volume and returns the data corresponding to the read request to the host.
[0061] Based on the above embodiments, as a specific implementation method, it further includes: The generation module is used to generate a write request based on the data corresponding to the read request returned by the disaster recovery volume; the write request carries the data returned by the disaster recovery volume. The distribution module is used to distribute the write request to the storage backend of the production volume, so that the storage backend writes the data carried by the write request into the media error area of the storage backend.
[0062] The generation module generates write requests based on the data corresponding to the read requests returned by the disaster recovery volume; the write requests carry the data corresponding to the read requests. The distribution module distributes the write requests to the storage backend of the production volume, thereby enabling the backend storage of the production volume to write the data carried by the write requests to the media-faulted area on the hard drive. Using the data returned by the disaster recovery volume to overwrite the media-faulted area and repair the media errors in the production volume can improve the availability of the production volume.
[0063] Based on the above embodiments, as a specific implementation method, it further includes: A write result receiving module is used to receive the write result returned by the storage backend; The first alarm information reporting module is used to report alarm information if the write result indicates a write failure, so as to prompt the target object that the production volume has an irreparable media error.
[0064] The write result receiving module receives the write result returned by the backend storage. If the write result indicates a write failure, the media error is determined to be an unrecoverable media error, possibly due to hardware damage. In this case, the write operation is not retried, and the first alarm information reporting module directly reports an alarm to indicate that the target object's production volume has an unrecoverable media error, and recommends that the target object replace the hard drive to resolve the media error issue.
[0065] Based on the above embodiments, as a specific implementation method, returning the data corresponding to the read request to the host takes precedence over generating a write request based on the data corresponding to the read request returned by the disaster recovery volume.
[0066] The response module 40 receives the data corresponding to the read request returned by the disaster recovery volume and first returns the data corresponding to the read request to the host. Then, the generation module generates a write request based on the data corresponding to the read request returned by the disaster recovery volume; the write request carries the data corresponding to the read request. The distribution module distributes the write request to the storage backend of the production volume, thereby enabling the backend storage of the production volume to write the data carried by the write request to the area of the hard disk with media errors.
[0067] Based on the above embodiments, as a specific implementation method, the determination module 20 includes: The viewing unit is used to view the corresponding bit in the remote copy bitmap based on the logical block address and data length in the read request. The first determining unit is configured to determine that if the bit is a first value, the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume. The second determining unit is configured to determine that if the bit is a second value, the data corresponding to the read request has not been synchronized between the production volume and the disaster recovery volume.
[0068] The checking unit examines the corresponding bits in the remote replication bitmap based on the logical block address and data length in the read request. If the bit is a first value, the first determining unit determines that the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume, meaning the data of the logical block with the media error has been synchronized between the production volume and the disaster recovery volume. If the bit is a second value, the second determining unit determines that the data corresponding to the read request has not been synchronized between the production volume and the disaster recovery volume, meaning the data of the logical block with the media error has not been synchronized between the production volume and the disaster recovery volume.
[0069] For example, if the bit is 0, it indicates whether the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume. If the bit is 1, it indicates whether the data corresponding to the read request has not been synchronized between the production volume and the disaster recovery volume.
[0070] Based on the above embodiments, as a specific implementation method, it further includes: The second response module is used to return information indicating a media error in the production volume to the host if the read result returned by the disaster recovery volume indicates a read failure.
[0071] If the disaster recovery volume returns a read result indicating a read failure, the second response module returns information to the host indicating a media error in the production volume. For example, the remote replication function module returns a Medium Error to the host.
[0072] Based on the above embodiments, as a specific implementation method, it further includes: The reread module is used to resend the request to the disaster recovery volume if the read result returned by the disaster recovery volume is a read timeout, so as to reread the data corresponding to the read request from the disaster recovery volume. The third response module is used to return information indicating a media error in the production volume to the host when the read results returned by the disaster recovery volume for a consecutive preset number of times are all read timeouts.
[0073] If the read result returned by the disaster recovery volume indicates a read timeout, the reread module resends the request to the disaster recovery volume to reread the data corresponding to the read request. If the disaster recovery volume returns a read timeout after each request after sending a preset number of consecutive requests, the third response module returns information to the host indicating a media error in the production volume.
[0074] Based on the above embodiments, as a specific implementation method, it further includes: The fourth response module is used to return information indicating a media error in the production volume to the host if the data corresponding to the read request has not been synchronized between the production volume and the disaster recovery volume.
[0075] If the data corresponding to the read request has not been synchronized between the production volume and the disaster recovery volume, indicating that the corresponding data on the disaster recovery volume is old data and unusable, the fourth response module returns information to the host indicating that a media error has occurred on the production volume.
[0076] Based on the above embodiments, as a specific implementation method, it further includes: The second alarm information reporting module is used to report alarm information if the data corresponding to the read request is not synchronized between the production volume and the disaster recovery volume, so as to indicate that the target object data reading has failed.
[0077] If the data corresponding to the read request has not been synchronized between the production volume and the disaster recovery volume, it indicates that the corresponding data on the disaster recovery volume is old data and cannot be used. In this case, the second alarm information reporting module reports an alarm information to indicate that the target object has failed to read the data, so that the target object can take necessary measures to reduce the impact on the host business.
[0078] Based on the above embodiments, as a specific implementation method, the remote replication relationship between the production volume and the disaster recovery volume is a synchronous remote replication relationship.
[0079] Based on the above embodiments, as a specific implementation method, it further includes: The second sending module is used to send a request to the backup disaster recovery volume to read the data corresponding to the read request from the backup disaster recovery volume if the data corresponding to the read request has not been synchronized between the production volume and the disaster recovery volume.
[0080] If the data corresponding to the read request has not been synchronized between the production volume and the primary disaster recovery volume, the second sending module sends a request to the standby disaster recovery volume to read the data corresponding to the read request from the standby disaster recovery volume.
[0081] Based on the above embodiments, as a specific implementation method, it further includes: The synchronization and repair module is used to write the data read from the backup disaster recovery volume into the disaster recovery volume if data is successfully read from the backup disaster recovery volume, and to rewrite the media error area of the production volume using the data read from the backup disaster recovery volume.
[0082] If the data corresponding to the read request is successfully read from the standby disaster recovery volume, the synchronization and repair module writes the data returned by the standby disaster recovery volume to the corresponding location on the primary disaster recovery volume, and uses the data returned by the standby disaster recovery volume to overwrite the media error area of the production volume. This not only repairs the media error of the production volume, but also synchronizes the data between the production volume, the primary disaster recovery volume, and the standby disaster recovery volume.
[0083] The data reading device provided by this invention, when a production volume experiences a media error and cannot read the required data from the production volume, sends a request to the disaster recovery volume to read the required data from the disaster recovery volume, and returns the data returned by the disaster recovery volume to the host. Thus, when a production volume has a media error, it can read the required data from the disaster recovery volume and return it to the host, reducing the impact of a production volume media error on the host's services.
[0084] For a description of the features in the embodiment corresponding to the data reading device, please refer to the relevant description of the embodiment corresponding to the data reading method, which will not be repeated here.
[0085] Embodiments of the present invention also provide an electronic device, with reference to Figure 5 As shown, the electronic device includes a memory 1 and a processor 2. The memory 1 stores a computer program, and the processor 2 is configured to run the computer program to perform the steps in any of the above-described data reading method embodiments.
[0086] The electronic device provided by this invention, when a media error occurs in the production volume and the required data cannot be read from the production volume, sends a request to the disaster recovery volume to read the required data from the disaster recovery volume, and returns the data returned by the disaster recovery volume to the host. In this way, when a media error occurs in the production volume, the required data can be read from the disaster recovery volume and returned to the host, thereby reducing the impact of a media error in the production volume on the host's services.
[0087] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above-described data reading method embodiments when it is run.
[0088] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0089] Embodiments of the present invention also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described data reading method embodiments.
[0090] Embodiments of the present invention also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above-described data reading method embodiments.
[0091] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0092] The data reading method, electronic device, storage medium, and program product provided by this invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the above embodiments are only intended to help understand the method and core ideas of this invention. It should be noted that those skilled in the art can make various improvements and modifications to this invention without departing from its principles, and these improvements and modifications also fall within the protection scope of this invention.
Claims
1. A data reading method, characterized in that, include: Receive read requests from the host and read the corresponding data from the production volume according to the read requests; If the read result indicates a media error in the production volume, then based on the remote replication bitmap, it is determined whether the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume. If the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume, then a request is sent to the disaster recovery volume to read the data corresponding to the read request from the disaster recovery volume; Receive the data corresponding to the read request returned by the disaster recovery volume, and return the data corresponding to the read request to the host.
2. The data reading method according to claim 1, characterized in that, Also includes: Based on the data corresponding to the read request returned by the disaster recovery volume, a write request is generated; The write request carries the data returned by the disaster recovery volume; The write request is sent to the storage backend of the production volume so that the storage backend writes the data carried by the write request into the media error area of the storage backend.
3. The data reading method according to claim 2, characterized in that, Also includes: Receive the write result returned by the storage backend; If the write result indicates a write failure, an alarm message is reported to indicate that an irreparable media error has occurred on the production volume of the target object.
4. The data reading method according to claim 2, characterized in that, Returning the data corresponding to the read request to the host takes precedence over generating a write request based on the data corresponding to the read request returned by the disaster recovery volume.
5. The data reading method according to claim 1, characterized in that, Determining whether the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume based on the remote replication bitmap includes: Based on the logical block address and data length in the read request, check the corresponding bit in the remote copy bitmap; If the bit is the first value, then the data corresponding to the read request has been synchronized between the production volume and the disaster recovery volume; If the bit is the second value, then the data corresponding to the read request has not been synchronized between the production volume and the disaster recovery volume.
6. The data reading method according to claim 1, characterized in that, Also includes: If the disaster recovery volume returns a read result indicating a read failure, then information indicating a media error has occurred on the production volume is returned to the host.
7. The data reading method according to claim 1, characterized in that, Also includes: If the read result returned by the disaster recovery volume indicates a read timeout, then a new request is sent to the disaster recovery volume to reread the data corresponding to the read request from the disaster recovery volume. If the read results returned by the disaster recovery volume for a preset number of consecutive times all indicate read timeout, then information indicating that the production volume has a media error is returned to the host.
8. The data reading method according to claim 1, characterized in that, Also includes: If the data corresponding to the read request has not been synchronized between the production volume and the disaster recovery volume, then information indicating a media error in the production volume is returned to the host.
9. The data reading method according to claim 1, characterized in that, Also includes: If the data corresponding to the read request is not synchronized between the production volume and the disaster recovery volume, an alarm message will be reported to indicate that the target object data read failed.
10. The data reading method according to claim 1, characterized in that, The remote replication relationship between the production volume and the disaster recovery volume is a synchronous remote replication relationship.
11. The data reading method according to claim 1, characterized in that, Also includes: If the data corresponding to the read request has not been synchronized between the production volume and the disaster recovery volume, a request is sent to the standby disaster recovery volume to read the data corresponding to the read request from the standby disaster recovery volume.
12. The data reading method according to claim 11, characterized in that, Also includes: If data is successfully read from the backup disaster recovery volume, the data read from the backup disaster recovery volume is written into the disaster recovery volume, and the data read from the backup disaster recovery volume is used to overwrite the media error area of the production volume.
13. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the data reading method as described in any one of claims 1 to 12 when executing the computer program.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the data reading method as described in any one of claims 1 to 12.
15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the data reading method as described in any one of claims 1 to 12.
Citation Information
Patent Citations
Record data network storage method and system and video monitoring platform
CN104469310A
Two-place three-center disaster recovery method, apparatus, device and system
CN108874593A
Storage medium detection method, device and equipment and readable storage medium
CN111048139A
Disaster recovery exception processing method and system, computer equipment and storage medium
CN115454709A
Network request retry method and device, electronic equipment and computer storage medium
CN118677941A