A data reading method, device, electronic equipment and storage medium
By determining the target site and data address in the distributed object storage system, the problems of data inconsistency and outdated versions are solved, ensuring that users obtain the latest version of the data and improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INSPUR SUZHOU INTELLIGENT TECH CO LTD
- Filing Date
- 2024-12-18
- Publication Date
- 2026-05-26
AI Technical Summary
In distributed object storage systems, users may encounter data inconsistencies and outdated versions when retrieving data from different sites, which can negatively impact user experience.
By receiving data read requests, the synchronization status between the master and slave sites is obtained. Based on the synchronization status and deletion policy, the target site and data address are determined, and the latest version of the target object data is read to ensure data consistency.
This ensures that the data obtained from different sites remains consistent and is always the latest version, thus improving the user experience.
Smart Images

Figure CN119782424B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of object storage technology, and in particular to a data reading method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the rapid development of cloud computing technology and the arrival of the big data era, distributed object storage services, characterized by security, reliability, elastic capacity scaling, ease of use, high performance, and low cost, have been widely adopted by enterprise application systems. Currently, object storage service providers enhance user experience by achieving high system availability through asynchronous data replication with multiple replicas. Asynchronous replication technology, in particular, emphasizes availability. When a user requests to update data, the master site can respond directly after processing the request without waiting for the slave site to complete synchronization. That is, the slave site will asynchronously synchronize the data, and the user's update operation will not be blocked due to the slave site's failure to complete data synchronization.
[0003] This approach ensures system availability, but when data is not synchronized across different sites, users may encounter inconsistencies or outdated data versions when accessing data from different sites. This issue can cause inconvenience to users and significantly reduce their satisfaction.
[0004] Therefore, there is an urgent need to propose a data reading method, device, electronic device, and storage medium that can ensure that the data obtained by users on different sites is always consistent and the latest version. Summary of the Invention
[0005] Therefore, it is necessary to provide a data reading method, apparatus, electronic device, and storage medium that can ensure that the data obtained by users on different sites is always consistent and the latest version, in order to address the above-mentioned technical problems.
[0006] Firstly, a data reading method is provided, applied to an object storage system, the object storage system including a master site and slave sites, the master site including a first local storage bucket, the method including:
[0007] Receive a data read request, wherein the data read request includes the index information of the target object;
[0008] Obtain the synchronization status of the target object between the master site and the slave site, where the synchronization status includes whether the first synchronization has been completed or not.
[0009] In response to the synchronization status being "Initial synchronization not completed", the primary site is determined as the target site, and the first local storage bucket is determined as the target data address corresponding to the target site;
[0010] The target object data is read from the first local storage bucket based on the index information in response to the data read request;
[0011] In response to the synchronization status indicating that the first synchronization has been completed, obtain the deletion status of the target object and the deletion policy of the object storage system;
[0012] Based on the deletion policy and deletion status, determine the target site and the target data address corresponding to the target site;
[0013] The target object data is read from the target data address of the target site based on the index information in response to the data read request.
[0014] In one embodiment, determining the target site and the target data address corresponding to the target site based on the deletion policy and deletion status includes:
[0015] Based on the deletion policy and deletion status, determine the first target metadata address of the primary site and the second target metadata address of the secondary site;
[0016] The first target object metadata is read from the first target metadata address and the second target object metadata is read from the second target metadata address according to the index information. The first target object metadata includes the first modification time of the target object and the second target object metadata includes the second modification time of the target object.
[0017] Compare the first modification time with the second modification time to obtain the time comparison result;
[0018] In response to the fact that the first modification time is later than the second modification time, the main site is used as the target site, and the target data address corresponding to the main site is determined according to the deletion policy and deletion status.
[0019] In response to the first modification time being earlier than the second modification time, the slave site will be used as the target site, and the target data address corresponding to the slave site will be determined according to the deletion policy and deletion status.
[0020] In one embodiment, the slave site includes a second local storage bucket, and the target site and the target data address corresponding to the target site are determined based on the deletion policy and deletion status, including:
[0021] In response to the deletion policy being synchronous deletion, and the target object not being deleted in either the primary or secondary site, the first local storage bucket is determined as the first target metadata address, and the second local storage bucket is determined as the second target metadata address.
[0022] Based on the index information, read the metadata of the first target object from the first local storage bucket and read the metadata of the second target object from the second local storage bucket;
[0023] Compare the first modification time with the second modification time to obtain the time comparison result;
[0024] In response to the fact that the first modification time is later than the second modification time, the primary site is determined as the target site, and the first local storage bucket is determined as the target data address;
[0025] The target object data is read from the first local storage bucket based on the index information in response to the data read request;
[0026] In response to the fact that the first modification time is earlier than the second modification time, the site will be determined as the target site, and the second local storage bucket will be determined as the target data address;
[0027] The target object data is read from the second local storage bucket based on the index information in response to the data read request.
[0028] In one embodiment, the master site further includes a primary storage bucket, and the slave site includes a second local storage bucket and a secondary storage bucket. The target site and its corresponding target data address are determined based on the deletion policy and deletion status, including:
[0029] In response to the deletion strategy being hierarchical deletion, and the target object being deleted in the main site but not in the slave site, the first local storage bucket is determined as the first target metadata address, and the second local storage bucket is determined as the second target metadata address.
[0030] Based on the index information, read the metadata of the first target object from the first local storage bucket and read the metadata of the second target object from the second local storage bucket;
[0031] Compare the first modification time with the second modification time to obtain the time comparison result;
[0032] In response to the fact that the first modification time is later than the second modification time, the primary site is determined as the target site, and the primary storage bucket is determined as the target data address corresponding to the primary site;
[0033] The target object data is read from the primary bucket based on the index information in response to the data read request;
[0034] In response to the fact that the first modification time is earlier than the second modification time, the slave site is determined as the target site, and the second local storage bucket is determined as the target data address corresponding to the slave site;
[0035] The target object data is read from the second local storage bucket based on the index information in response to the data read request.
[0036] In one embodiment, the master site further includes a primary storage bucket, and the slave site includes a second local storage bucket and a secondary storage bucket. The target site and its corresponding target data address are determined based on the deletion policy and deletion status, including:
[0037] In response to the deletion strategy being hierarchical deletion, and the target object being deleted in both the primary and secondary sites, the first local storage bucket is determined as the first target metadata address, and the second local storage bucket is determined as the second target metadata address.
[0038] Based on the index information, read the metadata of the first target object from the first local storage bucket and read the metadata of the second target object from the second local storage bucket;
[0039] Compare the first modification time with the second modification time to obtain the time comparison result;
[0040] In response to the fact that the first modification time is later than the second modification time, the primary site is determined as the target site, and the primary storage bucket is determined as the target data address corresponding to the primary site;
[0041] The target object data is read from the primary bucket based on the index information in response to the data read request;
[0042] In response to the first modification time being earlier than the second modification time, the slave site will be identified as the target site, and the secondary storage bucket will be identified as the target data address corresponding to the slave site.
[0043] The target object data is read from the secondary bucket based on the index information in response to the data read request.
[0044] In one embodiment, the master site further includes a primary storage bucket, and the slave site includes a second local storage bucket and a secondary storage bucket. The target site and its corresponding target data address are determined based on the deletion policy and deletion status, including:
[0045] In response to the deletion policy being archive deletion, and the target object being deleted in the primary site but not in the secondary site, the first primary bucket is determined as the first target metadata address, and the second local bucket is determined as the second target metadata address.
[0046] Based on the index information, read the metadata of the first target object from the first-level storage bucket and the metadata of the second target object from the second local storage bucket;
[0047] Compare the first modification time with the second modification time to obtain the time comparison result;
[0048] In response to the fact that the first modification time is later than the second modification time, the primary site is determined as the target site, and the primary storage bucket is determined as the target data address corresponding to the primary site;
[0049] The target object data is read from the primary bucket based on the index information in response to the data read request;
[0050] In response to the fact that the first modification time is earlier than the second modification time, the slave site is determined as the target site, and the second local storage bucket is determined as the target data address corresponding to the slave site;
[0051] The target object data is read from the second local storage bucket based on the index information in response to the data read request.
[0052] In one embodiment, the master site further includes a primary storage bucket, and the slave site includes a second local storage bucket and a secondary storage bucket. The target site and its corresponding target data address are determined based on the deletion policy and deletion status, including:
[0053] In response to the deletion policy being archive deletion, and the target object being deleted in both the primary and secondary sites, the first-level storage bucket is determined as the first target metadata address, and the second-level storage bucket is determined as the second target metadata address.
[0054] Based on the index information, read the metadata of the first target object from the first-level storage bucket and read the metadata of the second target object from the second-level storage bucket;
[0055] Compare the first modification time with the second modification time to obtain the time comparison result;
[0056] In response to the fact that the first modification time is later than the second modification time, the primary site is determined as the target site, and the primary storage bucket is determined as the target data address corresponding to the primary site;
[0057] The target object data is read from the primary bucket based on the index information in response to the data read request;
[0058] In response to the first modification time being earlier than the second modification time, the slave site will be identified as the target site, and the secondary storage bucket will be identified as the target data address corresponding to the slave site.
[0059] The target object data is read from the secondary bucket based on the index information in response to the data read request.
[0060] Secondly, a data reading device is provided, the device comprising:
[0061] The receiving module is used to receive data read requests, wherein the data read requests include the index information of the target object;
[0062] The first acquisition module is used to acquire the synchronization status of the target object between the master site and the slave site. The synchronization status includes the first synchronization completed and the first synchronization not completed.
[0063] The first determining module is used to determine the main site as the target site and the first local storage bucket as the target data address in response to the synchronization status being "initial synchronization not completed".
[0064] The first reading module is used to read target object data from the first local storage bucket according to the index information in response to the data reading request;
[0065] The second acquisition module is used to acquire the deletion policy of the object storage system and the deletion status of the target object in response to the synchronization status being that the first synchronization has been completed.
[0066] The second determining module is used to determine the target site and the target data address corresponding to the target site based on the deletion strategy and deletion status.
[0067] The second reading module is used to read target object data from the target data address on the target site according to the index information in response to the data reading request.
[0068] Thirdly, an electronic device is provided, comprising one or more processors; and a memory associated with the one or more processors, the memory for storing program instructions, which, when read and executed by the one or more processors, perform the steps of any of the methods described in the first aspect above.
[0069] Fourthly, a computer-readable storage medium is provided, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of any one of the methods described in the first aspect are performed.
[0070] Fifthly, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the steps of any one of the methods described in the first aspect above.
[0071] The aforementioned data reading method, apparatus, electronic device, and storage medium, when the synchronization status is "initial synchronization not yet completed," use the main site as the target site and the first local storage bucket as the target data address corresponding to the target site; when the synchronization status is "initial synchronization completed," determine the target site and the target data address corresponding to the target site according to the deletion policy and deletion status; and read the target object data from the target data address of the target site according to the index information to respond to the data reading request, so that the data obtained by the user on different sites is always consistent and is the latest version of the object. Attached Figure Description
[0072] Figure 1 This is a flowchart illustrating a data reading method in one embodiment;
[0073] Figure 2 A flowchart illustrating the data reading method when the deletion strategy is synchronous deletion;
[0074] Figure 3 This is a flowchart illustrating the data reading method when the initial synchronization has been completed and the deletion strategy is hierarchical deletion.
[0075] Figure 4 This is a flowchart illustrating the data reading method when the initial synchronization has been completed and the deletion strategy is archive deletion.
[0076] Figure 5 This is a structural block diagram of a data reading device in one embodiment;
[0077] Figure 6 This is a diagram of the internal structure of an electronic device in one embodiment. Detailed Implementation
[0078] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0079] Example 1
[0080] In one embodiment, such as Figure 1 , Figure 2 As shown, a data reading method is provided, applied to an object storage system. The object storage system includes a master site and slave sites. The master site includes a first local storage bucket. The method includes:
[0081] Receive a data read request, wherein the data read request includes the index information of the target object;
[0082] Obtain the synchronization status of the target object between the master site and the slave site, where the synchronization status includes whether the first synchronization has been completed or not.
[0083] In response to the synchronization status being "Initial synchronization not completed", the primary site is determined as the target site, and the first local storage bucket is determined as the target data address corresponding to the target site;
[0084] The target object data is read from the first local storage bucket based on the index information in response to the data read request;
[0085] In response to the synchronization status indicating that the first synchronization has been completed, obtain the deletion status of the target object and the deletion policy of the object storage system;
[0086] Based on the deletion policy and deletion status, determine the target site and the target data address corresponding to the target site;
[0087] The target object data is read from the target data address of the target site based on the index information in response to the data read request.
[0088] Specifically, the site receiving the data read request could be either the primary site or a secondary site. When the synchronization status is "Initial synchronization incomplete," the deletion policy will not be triggered, and if the target object data is not found in the first local storage bucket, the user will be prompted that a data read failure has occurred. When the synchronization status is "Initial synchronization incomplete," the primary site is used as the target site, and the first local storage bucket is used as the target data address corresponding to the target site. When the synchronization status is "Initial synchronization completed," the target site and its corresponding target data address are determined based on the deletion policy and deletion status. The target object data is read from the target data address of the target site according to the index information to respond to the data read request, ensuring that the data obtained by the user on different sites is always consistent and is the latest version of the object.
[0089] Furthermore, before receiving a data read request, the method further includes: in response to receiving a user creation request, creating a user on the primary site and / or the secondary site; in response to receiving a bucket creation request, creating a storage bucket under the user on the primary site and / or the secondary site; and in response to receiving a bucket creation success signal, uploading the storage object to the storage bucket on the primary site and / or the secondary site. The storage bucket includes a local storage bucket and a secondary storage bucket, and the storage object includes the target object.
[0090] In addition, lifecycle management configurations can be performed on buckets, and origin pull functionality can be set up for the primary and secondary sites. This origin pull function can read data from the secondary buckets of the corresponding site. The lifecycle management configurations include a tiered deletion strategy: copying object data and object metadata to the secondary bucket of the corresponding site, then deleting the object data in the local bucket, retaining only the object metadata and object index information locally; and an archive deletion strategy: archiving the object data, object metadata, and object index information to the secondary bucket of the corresponding site, then deleting the object data, object metadata, and object index information in the local bucket.
[0091] In one embodiment, determining the target site and the target data address corresponding to the target site based on the deletion policy and deletion status includes:
[0092] Based on the deletion policy and deletion status, determine the first target metadata address of the primary site and the second target metadata address of the secondary site;
[0093] The first target object metadata is read from the first target metadata address and the second target object metadata is read from the second target metadata address according to the index information. The first target object metadata includes the first modification time of the target object and the second target object metadata includes the second modification time of the target object.
[0094] Compare the first modification time with the second modification time to obtain the time comparison result;
[0095] In response to the fact that the first modification time is later than the second modification time, the main site is used as the target site, and the target data address corresponding to the main site is determined according to the deletion policy and deletion status.
[0096] In response to the first modification time being earlier than the second modification time, the slave site will be used as the target site, and the target data address corresponding to the slave site will be determined according to the deletion policy and deletion status.
[0097] Specifically, the target metadata address of each site is determined based on the deletion policy and deletion status; the first modification time and the second modification time are obtained based on the target metadata address; the target site is determined by comparing the first modification time and the second modification time, so that the target object data is the latest version, so that the target data address corresponding to the site can be determined based on the deletion policy and deletion status.
[0098] In one embodiment, such as Figure 2 As shown, the site includes a second local storage bucket. Based on the deletion policy and deletion status, the target site and the corresponding target data address are determined, including:
[0099] In response to the deletion policy being synchronous deletion, and the target object not being deleted in either the primary or secondary site, the first local storage bucket is determined as the first target metadata address, and the second local storage bucket is determined as the second target metadata address.
[0100] Based on the index information, read the metadata of the first target object from the first local storage bucket and read the metadata of the second target object from the second local storage bucket;
[0101] Compare the first modification time with the second modification time to obtain the time comparison result;
[0102] In response to the fact that the first modification time is later than the second modification time, the primary site is determined as the target site, and the first local storage bucket is determined as the target data address;
[0103] The target object data is read from the first local storage bucket based on the index information in response to the data read request;
[0104] In response to the fact that the first modification time is earlier than the second modification time, the site will be determined as the target site, and the second local storage bucket will be determined as the target data address;
[0105] The target object data is read from the second local storage bucket based on the index information in response to the data read request.
[0106] Specifically, synchronous deletion can also be understood as the primary and secondary sites not having a back-to-origin function configured. When the deletion strategy is synchronous deletion, and the target object has not been deleted in either the primary or secondary site, the first modification time and the second modification time in the first and second local storage buckets are compared to determine the target site. When the secondary site is the target site, the target object data in the second local storage bucket is searched and returned. When the primary site is the target site, the target object data in the first local storage bucket is searched and returned, ensuring that the data obtained by the user on different sites is always consistent and is the latest version of the object.
[0107] In one embodiment, such as Figure 3 As shown, the primary site also includes a first-level storage bucket, and the secondary site includes a second local storage bucket and a second-level storage bucket. Based on the deletion policy and deletion status, the target site and its corresponding target data address are determined, including:
[0108] In response to the deletion strategy being hierarchical deletion, and the target object being deleted in the main site but not in the slave site, the first local storage bucket is determined as the first target metadata address, and the second local storage bucket is determined as the second target metadata address.
[0109] Based on the index information, read the metadata of the first target object from the first local storage bucket and read the metadata of the second target object from the second local storage bucket;
[0110] Compare the first modification time with the second modification time to obtain the time comparison result;
[0111] In response to the fact that the first modification time is later than the second modification time, the primary site is determined as the target site, and the primary storage bucket is determined as the target data address corresponding to the primary site;
[0112] The target object data is read from the primary bucket based on the index information in response to the data read request;
[0113] In response to the fact that the first modification time is earlier than the second modification time, the slave site is determined as the target site, and the second local storage bucket is determined as the target data address corresponding to the slave site;
[0114] The target object data is read from the second local storage bucket based on the index information in response to the data read request.
[0115] Specifically, there may be situations where the primary site has not deleted the object, but the secondary site has. The data retrieval method is the same in these cases. When the deletion strategy is hierarchical deletion, and the target object has been deleted from the primary site but not from the secondary site, the first modification time and the second modification time in the first and second local storage buckets are compared to determine the target site. If the secondary site is the target site, the target object data in the second local storage bucket is searched and returned. If the primary site is the target site, the target object data in the first hierarchical storage bucket is searched and returned, ensuring that the data obtained by the user across different sites remains consistent and is always the latest version of the object.
[0116] In one embodiment, such as Figure 3 As shown, the primary site also includes a first-level storage bucket, and the secondary site includes a second local storage bucket and a second-level storage bucket. Based on the deletion policy and deletion status, the target site and its corresponding target data address are determined, including:
[0117] In response to the deletion strategy being hierarchical deletion, and the target object being deleted in both the primary and secondary sites, the first local storage bucket is determined as the first target metadata address, and the second local storage bucket is determined as the second target metadata address.
[0118] Based on the index information, read the metadata of the first target object from the first local storage bucket and read the metadata of the second target object from the second local storage bucket;
[0119] Compare the first modification time with the second modification time to obtain the time comparison result;
[0120] In response to the fact that the first modification time is later than the second modification time, the primary site is determined as the target site, and the primary storage bucket is determined as the target data address corresponding to the primary site;
[0121] The target object data is read from the primary bucket based on the index information in response to the data read request;
[0122] In response to the first modification time being earlier than the second modification time, the slave site will be identified as the target site, and the secondary storage bucket will be identified as the target data address corresponding to the slave site.
[0123] The target object data is read from the secondary bucket based on the index information in response to the data read request.
[0124] Specifically, when the deletion strategy is hierarchical deletion, and the target object has been deleted in both the primary and secondary sites, the first modification time and the second modification time in the first and second local storage buckets are compared to determine the target site; when the secondary site is the target site, the target object data in the second-level storage bucket is searched and returned; when the primary site is the target site, the target object data in the first-level storage bucket is searched and returned, so that the data obtained by the user on different sites is always consistent and is the latest version of the object.
[0125] In one embodiment, such as Figure 4 As shown, the primary site also includes a first-level storage bucket, and the secondary site includes a second local storage bucket and a second-level storage bucket. Based on the deletion policy and deletion status, the target site and its corresponding target data address are determined, including:
[0126] In response to the deletion policy being archive deletion, and the target object being deleted in the primary site but not in the secondary site, the first primary bucket is determined as the first target metadata address, and the second local bucket is determined as the second target metadata address.
[0127] Based on the index information, read the metadata of the first target object from the first-level storage bucket and the metadata of the second target object from the second local storage bucket;
[0128] Compare the first modification time with the second modification time to obtain the time comparison result;
[0129] In response to the fact that the first modification time is later than the second modification time, the primary site is determined as the target site, and the primary storage bucket is determined as the target data address corresponding to the primary site;
[0130] The target object data is read from the primary bucket based on the index information in response to the data read request;
[0131] In response to the fact that the first modification time is earlier than the second modification time, the slave site is determined as the target site, and the second local storage bucket is determined as the target data address corresponding to the slave site;
[0132] The target object data is read from the second local storage bucket based on the index information in response to the data read request.
[0133] Specifically, there may be situations where the primary site has not deleted the object, but the secondary site has. The data retrieval method is the same in these cases. When the deletion policy is archive deletion, and the target object has been deleted from the primary site but not from the secondary site, the first modification time and second modification time in the first-level storage bucket and the second local storage bucket are compared to determine the target site. If the secondary site is the target site, the target object data in the second local storage bucket is searched and returned. If the primary site is the target site, the target object data in the first-level storage bucket is searched and returned, ensuring that the data obtained by the user across different sites remains consistent and is always the latest version of the object.
[0134] In one embodiment, such as Figure 4 As shown, the primary site also includes a first-level storage bucket, and the secondary site includes a second local storage bucket and a second-level storage bucket. Based on the deletion policy and deletion status, the target site and its corresponding target data address are determined, including:
[0135] In response to the deletion policy being archive deletion, and the target object being deleted in both the primary and secondary sites, the first-level storage bucket is determined as the first target metadata address, and the second-level storage bucket is determined as the second target metadata address.
[0136] Based on the index information, read the metadata of the first target object from the first-level storage bucket and read the metadata of the second target object from the second-level storage bucket;
[0137] Compare the first modification time with the second modification time to obtain the time comparison result;
[0138] In response to the fact that the first modification time is later than the second modification time, the primary site is determined as the target site, and the primary storage bucket is determined as the target data address corresponding to the primary site;
[0139] The target object data is read from the primary bucket based on the index information in response to the data read request;
[0140] In response to the first modification time being earlier than the second modification time, the slave site will be identified as the target site, and the secondary storage bucket will be identified as the target data address corresponding to the slave site.
[0141] The target object data is read from the secondary bucket based on the index information in response to the data read request.
[0142] Specifically, when the deletion strategy is hierarchical deletion, and the target object has been deleted in both the primary and secondary sites, the first modification time and the second modification time in the first-level and second-level storage buckets are compared to determine the target site; when the secondary site is the target site, the target object data in the second-level storage bucket is searched and returned; when the primary site is the target site, the target object data in the first-level storage bucket is searched and returned, so that the data obtained by the user on different sites is always consistent and is the latest version of the object.
[0143] In one embodiment, such as Figure 2 As shown, the site includes a second local storage bucket. Based on the deletion policy and deletion status, the target site and the corresponding target data address are determined, including:
[0144] In response to the deletion policy being synchronous deletion, and the target object being deleted in the primary site but not in the secondary site, the secondary site will be identified as the target site, and the second local storage bucket will be identified as the target data address corresponding to the target site.
[0145] The target object data is read from the second local storage bucket based on the index information in response to the data read request;
[0146] In response to the deletion policy being synchronous deletion, and the target object being deleted in the slave site but not in the master site, the master site is identified as the target site, and the first local storage bucket is identified as the target data address corresponding to the target site.
[0147] The target object data is read from the first local storage bucket based on the index information in response to the data read request;
[0148] In response to the deletion policy being synchronous deletion, and the target object having been deleted from both the primary and secondary sites, a data retrieval failure is detected in the user's system.
[0149] Specifically, when the deletion strategy is synchronous deletion, and the target object has been deleted in the main site but not in the slave site, the slave site will be used as the target site to search for and return the target object data in the second local storage bucket. Similarly, when the deletion strategy is synchronous deletion, and the target object has not been deleted in the main site but has been deleted in the slave site, the main site will be used as the target site to search for and return the target object data in the first local storage bucket. When the deletion strategy is synchronous deletion, and the target object has been deleted in both the main site and the slave site, the user will be prompted that a data reading failure has occurred, so that the data obtained by the user on different sites is always consistent and is the latest version of the object.
[0150] It should be understood that, although Figure 1 , Figure 2 , Figure 3 , Figure 4The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 1 , Figure 2 , Figure 3 , Figure 4 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0151] Example 2
[0152] In one embodiment, such as Figure 5 As shown, a data reading device is provided, the device comprising:
[0153] The receiving module is used to receive data read requests, wherein the data read requests include the index information of the target object;
[0154] The first acquisition module is used to acquire the synchronization status of the target object between the master site and the slave site. The synchronization status includes the first synchronization completed and the first synchronization not completed.
[0155] The first determining module is used to determine the main site as the target site and the first local storage bucket as the target data address in response to the synchronization status being "initial synchronization not completed".
[0156] The first reading module is used to read target object data from the first local storage bucket according to the index information in response to the data reading request;
[0157] The second acquisition module is used to acquire the deletion policy of the object storage system and the deletion status of the target object in response to the synchronization status being that the first synchronization has been completed.
[0158] The second determining module is used to determine the target site and the target data address corresponding to the target site based on the deletion strategy and deletion status.
[0159] The second reading module is used to read target object data from the target data address on the target site according to the index information in response to the data reading request.
[0160] In one embodiment, the second determining module is further configured to:
[0161] Based on the deletion policy and deletion status, determine the first target metadata address of the primary site and the second target metadata address of the secondary site;
[0162] The first target object metadata is read from the first target metadata address and the second target object metadata is read from the second target metadata address according to the index information. The first target object metadata includes the first modification time of the target object and the second target object metadata includes the second modification time of the target object.
[0163] Compare the first modification time with the second modification time to obtain the time comparison result;
[0164] In response to the fact that the first modification time is later than the second modification time, the main site is used as the target site, and the target data address corresponding to the main site is determined according to the deletion policy and deletion status.
[0165] In response to the first modification time being earlier than the second modification time, the slave site will be used as the target site, and the target data address corresponding to the slave site will be determined according to the deletion policy and deletion status.
[0166] In one embodiment, the site includes a second local storage bucket, and the second determining module is further configured to:
[0167] In response to the deletion policy being synchronous deletion, and the target object not being deleted in either the primary or secondary site, the first local storage bucket is determined as the first target metadata address, and the second local storage bucket is determined as the second target metadata address.
[0168] Based on the index information, read the metadata of the first target object from the first local storage bucket and read the metadata of the second target object from the second local storage bucket;
[0169] Compare the first modification time with the second modification time to obtain the time comparison result;
[0170] In response to the fact that the first modification time is later than the second modification time, the primary site is determined as the target site, and the first local storage bucket is determined as the target data address;
[0171] The target object data is read from the first local storage bucket based on the index information in response to the data read request;
[0172] In response to the fact that the first modification time is earlier than the second modification time, the site will be determined as the target site, and the second local storage bucket will be determined as the target data address;
[0173] The target object data is read from the second local storage bucket based on the index information in response to the data read request.
[0174] In one embodiment, the master site further includes a primary storage bucket, the slave site includes a second local storage bucket and a secondary storage bucket, and the second determining module is further configured to:
[0175] In response to the deletion strategy being hierarchical deletion, and the target object being deleted in the main site but not in the slave site, the first local storage bucket is determined as the first target metadata address, and the second local storage bucket is determined as the second target metadata address.
[0176] Based on the index information, read the metadata of the first target object from the first local storage bucket and read the metadata of the second target object from the second local storage bucket;
[0177] Compare the first modification time with the second modification time to obtain the time comparison result;
[0178] In response to the fact that the first modification time is later than the second modification time, the primary site is determined as the target site, and the primary storage bucket is determined as the target data address corresponding to the primary site;
[0179] The target object data is read from the primary bucket based on the index information in response to the data read request;
[0180] In response to the fact that the first modification time is earlier than the second modification time, the slave site is determined as the target site, and the second local storage bucket is determined as the target data address corresponding to the slave site;
[0181] The target object data is read from the second local storage bucket based on the index information in response to the data read request.
[0182] In one embodiment, the master site further includes a primary storage bucket, the slave site includes a second local storage bucket and a secondary storage bucket, and the second determining module is further configured to:
[0183] In response to the deletion strategy being hierarchical deletion, and the target object being deleted in both the primary and secondary sites, the first local storage bucket is determined as the first target metadata address, and the second local storage bucket is determined as the second target metadata address.
[0184] Based on the index information, read the metadata of the first target object from the first local storage bucket and read the metadata of the second target object from the second local storage bucket;
[0185] Compare the first modification time with the second modification time to obtain the time comparison result;
[0186] In response to the fact that the first modification time is later than the second modification time, the primary site is determined as the target site, and the primary storage bucket is determined as the target data address corresponding to the primary site;
[0187] The target object data is read from the primary bucket based on the index information in response to the data read request;
[0188] In response to the first modification time being earlier than the second modification time, the slave site will be identified as the target site, and the secondary storage bucket will be identified as the target data address corresponding to the slave site.
[0189] The target object data is read from the secondary bucket based on the index information in response to the data read request.
[0190] In one embodiment, the master site further includes a primary storage bucket, the slave site includes a second local storage bucket and a secondary storage bucket, and the second determining module is further configured to:
[0191] In response to the deletion policy being archive deletion, and the target object being deleted in the primary site but not in the secondary site, the first primary bucket is determined as the first target metadata address, and the second local bucket is determined as the second target metadata address.
[0192] Based on the index information, read the metadata of the first target object from the first-level storage bucket and the metadata of the second target object from the second local storage bucket;
[0193] Compare the first modification time with the second modification time to obtain the time comparison result;
[0194] In response to the fact that the first modification time is later than the second modification time, the primary site is determined as the target site, and the primary storage bucket is determined as the target data address corresponding to the primary site;
[0195] The target object data is read from the primary bucket based on the index information in response to the data read request;
[0196] In response to the fact that the first modification time is earlier than the second modification time, the slave site is determined as the target site, and the second local storage bucket is determined as the target data address corresponding to the slave site;
[0197] The target object data is read from the second local storage bucket based on the index information in response to the data read request.
[0198] In one embodiment, the master site further includes a primary storage bucket, the slave site includes a second local storage bucket and a secondary storage bucket, and the second determining module is further configured to:
[0199] In response to the deletion policy being archive deletion, and the target object being deleted in both the primary and secondary sites, the first-level storage bucket is determined as the first target metadata address, and the second-level storage bucket is determined as the second target metadata address.
[0200] Based on the index information, read the metadata of the first target object from the first-level storage bucket and read the metadata of the second target object from the second-level storage bucket;
[0201] Compare the first modification time with the second modification time to obtain the time comparison result;
[0202] In response to the fact that the first modification time is later than the second modification time, the primary site is determined as the target site, and the primary storage bucket is determined as the target data address corresponding to the primary site;
[0203] The target object data is read from the primary bucket based on the index information in response to the data read request;
[0204] In response to the first modification time being earlier than the second modification time, the slave site will be identified as the target site, and the secondary storage bucket will be identified as the target data address corresponding to the slave site.
[0205] The target object data is read from the secondary bucket based on the index information in response to the data read request.
[0206] Specific limitations regarding the data reading device can be found in the limitations of the data reading method described above, and will not be repeated here. Each module in the aforementioned data reading device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware within or independently of the processor in the electronic device, or stored in software within the memory of the electronic device, so that the processor can call and execute the operations corresponding to each module.
[0207] Example 3
[0208] In one embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:
[0209] Receive a data read request, wherein the data read request includes the index information of the target object;
[0210] Obtain the synchronization status of the target object between the master site and the slave site, where the synchronization status includes whether the first synchronization has been completed or not.
[0211] In response to the synchronization status being "Initial synchronization not completed", the primary site is determined as the target site, and the first local storage bucket is determined as the target data address corresponding to the target site;
[0212] The target object data is read from the first local storage bucket based on the index information in response to the data read request;
[0213] In response to the synchronization status indicating that the first synchronization has been completed, obtain the deletion status of the target object and the deletion policy of the object storage system;
[0214] Based on the deletion policy and deletion status, determine the target site and the target data address corresponding to the target site;
[0215] The target object data is read from the target data address of the target site based on the index information in response to the data read request.
[0216] When the program instructions are read and executed by one or more processors, they can also perform operations corresponding to the steps in the above method embodiments, as described above, and will not be repeated here. Reference Figure 6 This exemplifies the architecture of an electronic device, which may include a processor 610, a video display adapter 611, a disk drive 612, an input / output interface 613, a network interface 614, and a memory 620. The processor 610, video display adapter 611, disk drive 612, input / output interface 613, network interface 614, and memory 620 can communicate with each other via a communication bus 630.
[0217] The processor 610 can be implemented using a general-purpose central processing unit (CPU), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to achieve the technical solution provided in this application.
[0218] The memory 620 can be implemented as a read-only memory (ROM), random access memory (RAM), static storage device, dynamic storage device, etc. The memory 620 can store an operating system 621 for controlling the operation of the electronic device 600, and a basic input / output system (BIOS) 622 for controlling the low-level operations of the electronic device 600. Additionally, it can store a web browser 623, data storage management 624, and an icon / font processing system 625, etc. The aforementioned icon / font processing system 625 can be the application program that specifically implements the aforementioned steps in this embodiment. In summary, when implementing the technical solution provided in this application through software or firmware, the relevant program code is stored in the memory 620 and executed by the processor 610.
[0219] Input / output interface 613 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touch screens, microphones, various sensors, etc., and output devices may include displays, speakers, vibrators, indicator lights, etc.
[0220] Network interface 614 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0221] Bus 630 includes a pathway for transmitting information between various components of the device, such as processor 610, video display adapter 611, disk drive 612, input / output interface 613, network interface 614, and memory 620.
[0222] In addition, the electronic device 600 can also obtain information on specific acquisition conditions from the virtual resource object acquisition condition information database 641 for condition judgment, etc.
[0223] It should be noted that although the above-described electronic device 600 only shows a processor 610, a video display adapter 611, a disk drive 612, an input / output interface 613, a network interface 614, a memory 620, and a bus 630, in specific implementations, the electronic device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the solution of this application, and does not necessarily include all the components shown in the figures.
[0224] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause an electronic device (which may be a personal computer, cloud server, or network device, etc.) to execute the methods of various embodiments or some parts of the embodiments of this application.
[0225] Example 4
[0226] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0227] Receive a data read request, wherein the data read request includes the index information of the target object;
[0228] Obtain the synchronization status of the target object between the master site and the slave site, where the synchronization status includes whether the first synchronization has been completed or not.
[0229] In response to the synchronization status being "Initial synchronization not completed", the primary site is determined as the target site, and the first local storage bucket is determined as the target data address corresponding to the target site;
[0230] The target object data is read from the first local storage bucket based on the index information in response to the data read request;
[0231] In response to the synchronization status indicating that the first synchronization has been completed, obtain the deletion status of the target object and the deletion policy of the object storage system;
[0232] Based on the deletion policy and deletion status, determine the target site and the target data address corresponding to the target site;
[0233] The target object data is read from the target data address of the target site based on the index information in response to the data read request.
[0234] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0235] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0236] The above embodiments merely illustrate several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
[0237] Example 5
[0238] In one embodiment, a computer program product is provided, on which a computer program is stored, the computer program performing the following steps when executed by a processor:
[0239] Receive a data read request, wherein the data read request includes the index information of the target object;
[0240] Obtain the synchronization status of the target object between the master site and the slave site, where the synchronization status includes whether the first synchronization has been completed or not.
[0241] In response to the synchronization status being "Initial synchronization not completed", the primary site is determined as the target site, and the first local storage bucket is determined as the target data address corresponding to the target site;
[0242] The target object data is read from the first local storage bucket based on the index information in response to the data read request;
[0243] In response to the synchronization status indicating that the first synchronization has been completed, obtain the deletion status of the target object and the deletion policy of the object storage system;
[0244] Based on the deletion policy and deletion status, determine the target site and the target data address corresponding to the target site;
[0245] The target object data is read from the target data address of the target site based on the index information in response to the data read request.
[0246] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer program product, and when the computer program is executed, it can include the processes of the embodiments of the methods described above.
[0247] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0248] The above embodiments merely illustrate several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A data reading method applied to an object storage system, the object storage system comprising a master site and slave sites, the master site comprising a first local storage bucket, characterized in that, The method includes: Receive a data read request, wherein the data read request includes index information of the target object; Obtain the synchronization status of the target object between the master site and the slave site, wherein the synchronization status includes the first synchronization completed and the first synchronization not completed; In response to the synchronization status being "first synchronization not completed", the master site is determined as the target site, and the first local storage bucket is determined as the target data address corresponding to the target site; The target object data is read from the first local storage bucket according to the index information in response to the data read request; In response to the synchronization status indicating that the first synchronization has been completed, the deletion status of the target object and the deletion policy of the object storage system are obtained. Based on the deletion strategy and deletion status, the target site and the target data address corresponding to the target site are determined. The deletion strategy includes synchronous deletion, hierarchical deletion, and archive deletion. The deletion status includes the following: the target object has not been deleted in either the main site or the slave site; the target object has been deleted in the main site but not in the slave site; the target object has not been deleted in the main site but has been deleted in the slave site; and the target object has been deleted in both the main site and the slave site. Read the target object data from the target data address of the target site according to the index information in response to the data read request; The determination of the target site and the target data address corresponding to the target site, based on the deletion strategy and deletion status, includes: Based on the deletion strategy and deletion status, the first target metadata address of the master site and the second target metadata address of the slave site are determined; The first target object metadata is read from the first target metadata address and the second target object metadata is read from the second target metadata address according to the index information, wherein the first target object metadata includes the first modification time of the target object and the second target object metadata includes the second modification time of the target object; Compare the first modification time with the second modification time to obtain the time comparison result; In response to the fact that the first modification time is later than the second modification time, the main site is taken as the target site, and the target data address corresponding to the main site is determined according to the deletion strategy and the deletion status. In response to the first modification time being earlier than the second modification time, the slave site is designated as the target site, and the target data address corresponding to the slave site is determined according to the deletion policy and the deletion status.
2. The method according to claim 1, characterized in that, The slave site includes a second local storage bucket. Based on the deletion policy and deletion status, the target site and the target data address corresponding to the target site are determined, including: In response to the deletion strategy being synchronous deletion, and the target object not being deleted in either the main site or the slave site, the first local storage bucket is determined as the first target metadata address, and the second local storage bucket is determined as the second target metadata address; Based on the index information, read the metadata of the first target object from the first local storage bucket and read the metadata of the second target object from the second local storage bucket; Compare the first modification time with the second modification time to obtain the time comparison result; In response to the fact that the first modification time is later than the second modification time, the main site is determined as the target site, and the first local storage bucket is determined as the target data address; The target object data is read from the first local storage bucket according to the index information in response to the data read request; In response to the first modification time being earlier than the second modification time, the slave site is determined as the target site, and the second local storage bucket is determined as the target data address; The target object data is read from the second local storage bucket according to the index information in response to the data read request.
3. The method according to claim 1, characterized in that, The primary site further includes a primary storage bucket, and the secondary site includes a second local storage bucket and a secondary storage bucket. Based on the deletion policy and deletion status, the target site and the target data address corresponding to the target site are determined, including: In response to the deletion strategy being hierarchical deletion, and the target object being deleted in the main site but not in the slave site, the first local storage bucket is determined as the first target metadata address, and the second local storage bucket is determined as the second target metadata address. Based on the index information, read the metadata of the first target object from the first local storage bucket and read the metadata of the second target object from the second local storage bucket; Compare the first modification time with the second modification time to obtain the time comparison result; In response to the fact that the first modification time is later than the second modification time, the main site is determined as the target site, and the first primary storage bucket is determined as the target data address corresponding to the main site; The target object data is read from the primary storage bucket according to the index information in response to the data read request; In response to the first modification time being earlier than the second modification time, the slave site is determined as the target site, and the second local storage bucket is determined as the target data address corresponding to the slave site; The target object data is read from the second local storage bucket according to the index information in response to the data read request.
4. The method according to claim 1, characterized in that, The primary site further includes a primary storage bucket, and the secondary site includes a second local storage bucket and a secondary storage bucket. Based on the deletion policy and deletion status, the target site and the target data address corresponding to the target site are determined, including: In response to the deletion strategy being hierarchical deletion, and the target object being deleted from both the main site and the slave site, the first local storage bucket is determined as the first target metadata address, and the second local storage bucket is determined as the second target metadata address. Based on the index information, read the metadata of the first target object from the first local storage bucket and read the metadata of the second target object from the second local storage bucket; Compare the first modification time with the second modification time to obtain the time comparison result; In response to the fact that the first modification time is later than the second modification time, the main site is determined as the target site, and the first primary storage bucket is determined as the target data address corresponding to the main site; The target object data is read from the primary storage bucket according to the index information in response to the data read request; In response to the first modification time being earlier than the second modification time, the slave site is determined as the target site, and the second-level storage bucket is determined as the target data address corresponding to the slave site; The target object data is read from the secondary storage bucket according to the index information in response to the data read request.
5. The method according to claim 1, characterized in that, The primary site further includes a primary storage bucket, and the secondary site includes a second local storage bucket and a secondary storage bucket. Based on the deletion policy and deletion status, the target site and the target data address corresponding to the target site are determined, including: In response to the deletion policy being archive deletion, and the target object being deleted in the primary site but not in the secondary site, the first primary storage bucket is determined as the first target metadata address, and the second local storage bucket is determined as the second target metadata address. Based on the index information, read the metadata of the first target object from the first-level storage bucket and read the metadata of the second target object from the second local storage bucket; Compare the first modification time with the second modification time to obtain the time comparison result; In response to the fact that the first modification time is later than the second modification time, the main site is determined as the target site, and the first primary storage bucket is determined as the target data address corresponding to the main site; The target object data is read from the primary storage bucket according to the index information in response to the data read request; In response to the first modification time being earlier than the second modification time, the slave site is determined as the target site, and the second local storage bucket is determined as the target data address corresponding to the slave site; The target object data is read from the second local storage bucket according to the index information in response to the data read request.
6. The method according to claim 1, characterized in that, The primary site further includes a primary storage bucket, and the secondary site includes a second local storage bucket and a secondary storage bucket. Based on the deletion policy and deletion status, the target site and the target data address corresponding to the target site are determined, including: In response to the deletion policy being archive deletion, and the target object being deleted in both the primary and secondary sites, the first-level storage bucket is determined as the first target metadata address, and the second-level storage bucket is determined as the second target metadata address. Based on the index information, read the metadata of the first target object from the first-level storage bucket and read the metadata of the second target object from the second-level storage bucket; Compare the first modification time with the second modification time to obtain the time comparison result; In response to the fact that the first modification time is later than the second modification time, the main site is determined as the target site, and the first primary storage bucket is determined as the target data address corresponding to the main site; The target object data is read from the primary storage bucket according to the index information in response to the data read request; In response to the first modification time being earlier than the second modification time, the slave site is determined as the target site, and the second-level storage bucket is determined as the target data address corresponding to the slave site; The target object data is read from the secondary storage bucket according to the index information in response to the data read request.
7. A data reading apparatus for implementing the data reading method as described in claim 1, characterized in that, The device includes: A receiving module is configured to receive a data read request, wherein the data read request includes index information of the target object; The first acquisition module is used to acquire the synchronization status of the target object between the master site and the slave site, wherein the synchronization status includes the first synchronization completed and the first synchronization not completed; The first determining module is configured to, in response to the synchronization status being "initial synchronization not completed", determine the main site as the target site and the first local storage bucket as the target data address; The first reading module is used to read target object data from the first local storage bucket according to the index information in response to the data reading request; The second acquisition module is used to acquire the deletion policy of the object storage system and the deletion status of the target object in response to the synchronization status being that the first synchronization has been completed. The second determining module is used to determine the target site and the target data address corresponding to the target site based on the deletion strategy and deletion status. The second reading module is used to read target object data from the target data address on the target site according to the index information in response to the data reading request.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.