A metadata reconstruction method and electronic device

By acquiring the unsynchronized operation logs during the target object storage device failure, and based on the incremental reconstruction mechanism, the problem of long metadata reconstruction time and high resource consumption in distributed storage systems is solved, realizing fast and accurate metadata recovery and ensuring the high availability and business continuity of storage services.

CN123114864APending Publication Date: 2026-11-17JINAN INSPUR DATA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611495086.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-23
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

In distributed object storage systems, the metadata reconstruction process is time-consuming and resource-intensive, leading to business unavailability and reduced system throughput. Furthermore, the lack of flexible control mechanisms makes it difficult to adapt to diverse scenario requirements.

Method used

By acquiring the unsynchronized operation logs during the target object storage device failure, and based on the incremental reconstruction mechanism, only the actual changed data is restored, avoiding full scan and reconstruction. The reconstruction mode is controlled by the function flag bit, achieving fast and accurate metadata recovery.

Benefits of technology

It shortens recovery time, reduces system resource consumption, prevents business interruption, ensures high availability and business continuity of storage services, and improves metadata recovery efficiency and system availability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123114864A_ABST
    Figure CN123114864A_ABST
Patent Text Reader

Abstract

This application provides a metadata reconstruction method, the method comprising: acquiring a first operation log that was not synchronized during a failure of a target object storage device, the first operation log including operation change types corresponding to business operations performed on object data; and incrementally reconstructing the local data of the object storage device based on the first operation log. Applying the technical solution of this application can effectively solve the problem in the prior art where full reconstruction of large-scale metadata objects after a failure of a distributed file system leads to low recovery efficiency and business blockage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data management technology, and more specifically, to a metadata reconstruction method and an electronic device. Background Technology

[0002] In distributed object storage systems, user data and metadata are stored separately. Metadata is stored in key-value (KV) pairs via an omap structure in an independent metadata pool. Each metadata object typically encapsulates all metadata information of a data bucket. When the number of objects within a bucket reaches hundreds of millions, the number of omap KV entries contained in a single metadata object can reach millions, with a size approaching 300MB. When a node or OSD (Object-based Storage Device) fails in the cluster, the system needs to reconstruct and recover lost or damaged metadata objects. Existing technologies employ a full scan and synchronization mechanism: that is, reading all omap data (approximately 300MB) of the metadata object before the failure, and verifying and reconstructing all KV entries one by one on the recovery node to ensure metadata integrity. This process consumes a large amount of network bandwidth, disk I / O, and CPU resources, and during reconstruction, write locking is implemented on the storage bucket to which the target metadata object belongs, blocking core business operations such as object upload, deletion, and attribute modification.

[0003] In the aforementioned technologies, full reconstruction requires processing massive amounts of key-value data, and the recovery time is positively correlated with the size of the metadata objects. As the object size continues to grow, the reconstruction time increases exponentially, making it difficult to meet the business's requirements for rapid recovery. Simultaneously, prolonged write locking leads to business unavailability, severely impacting system availability and user experience. Furthermore, the high-intensity consumption of cluster resources during full reconstruction easily triggers resource contention, reducing overall system throughput. It also cannot adapt to the diverse needs of different metadata sizes across various scenarios, lacks flexible control mechanisms, and results in high operational costs and poor scalability. Summary of the Invention

[0004] This application provides a metadata reconstruction method, apparatus, storage medium, and electronic device to at least address the shortcomings of the full reconstruction mechanism in related technologies.

[0005] According to one embodiment of this application, a metadata reconstruction method is provided, the method comprising:

[0006] Obtain the first operation log that was not synchronized during the target object storage device failure. The first operation log includes the operation change types corresponding to business operations on object data. Based on the first operation log, perform incremental reconstruction of the local data of the object storage device.

[0007] In one exemplary embodiment, the business operation includes at least one of the following: object creation, object modification, object deletion, and object attribute change; the operation change type includes at least one of the following: write operation, delete operation, or clear operation; the first operation log also includes a key operation type corresponding to the business operation, and the key operation type includes a single-key operation or a multi-key batch operation.

[0008] In one exemplary embodiment, before acquiring the first operation log that was not synchronized during the target object storage device failure, the method further includes: when a business operation request for object data is received, recording the operation log corresponding to the business operation request, wherein the business operation request is used to request a business operation on the object data.

[0009] In one exemplary embodiment, obtaining a first operation log that was not synchronized during an object storage device failure includes: determining an authoritative log, where the authoritative log is the operation log of the object storage device that was not at fault; comparing and merging the authoritative log with a second operation log of the target object storage device to generate a first operation log, where the second operation log is the operation log before the target object storage device failed.

[0010] In one exemplary embodiment, comparing and merging logs based on the authoritative log and the operation log of the currently faulty object storage device includes: if the authoritative log contains a clear operation marker, then clearing all key operation records in the second operation log; if a key operation record exists in the authoritative log but not in the second operation log, then adding the record to the second operation log; if both the authoritative log and the second operation log contain operation records with the same key, then using the operation type in the authoritative log as the standard, overwriting the operation record in the second operation log.

[0011] In one exemplary embodiment, the metadata reconstruction method further includes: when the first operation log is empty and no clear operation is marked, performing a full reconstruction of the local data of the object storage device.

[0012] In an exemplary embodiment, incremental reconstruction of local data on an object storage device based on a first operation log includes: sending the operation change type and corresponding data to the target object storage device for incremental reconstruction, wherein: for a write operation, the key of the write operation and its corresponding value are sent; for a delete operation, the key of the delete operation and its corresponding value are sent; and for a clear operation, a clear instruction is pushed.

[0013] In one exemplary embodiment, the metadata reconstruction method further includes: setting a function flag bit, which is used to control whether to perform incremental reconstruction of the local data of the object storage device; when the function flag bit is enabled, performing incremental reconstruction of the local data of the object storage device; and when the function flag bit is disabled, performing full reconstruction of the local data of the object storage device.

[0014] In one exemplary embodiment, the function flags are configured independently for each object storage device and can be enabled or disabled via a command-line interface or a graphical management interface.

[0015] According to yet another embodiment of this application, a computer-readable storage medium is also provided, in which a computer program is stored, wherein the computer program is configured to perform the steps in any of the above method embodiments when it is run.

[0016] According to yet another embodiment of this application, an electronic device is also provided, including a memory and a processor, wherein a computer program is stored in the memory and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0017] By applying the technical solution of this application, the first operation log that was not synchronized during the failure of the target object storage device is obtained. This operation log accurately records the operation change types corresponding to various business operations performed on the object data, thereby locking out the differentiated change data that only needs to be recovered. On this basis, the local data is reconstructed in a targeted manner based only on these incremental change information, avoiding a full traversal and reconstruction of all metadata objects, shortening the recovery time, reducing system resource consumption, and effectively preventing business interruption or response delay caused by large-scale data synchronization. Therefore, it can solve the problem of low recovery efficiency and business blockage caused by full reconstruction after a failure in the distributed storage system in related technologies, and achieve the effect of fast, accurate, and low-disturbance metadata recovery, ensuring high availability and business continuity of storage services. Attached Figure Description

[0018] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0019] Figure 1 This is a schematic diagram of the hardware environment for an optional metadata reconstruction method according to an embodiment of this application;

[0020] Figure 2 This is a flowchart of an optional metadata reconstruction method according to an embodiment of this application;

[0021] Figure 3 This is a flowchart of an optional OMAP operation logging method according to an embodiment of this application;

[0022] Figure 4 This is a flowchart of an optional incremental reconstruction optimization of the Recover process according to an embodiment of this application;

[0023] Figure 5 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation

[0024] The embodiments of this application will be described in detail below with reference to the accompanying drawings and examples.

[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0026] For the technical terms and abbreviations used in this application, complete English descriptions and Chinese translations are provided to facilitate understanding:

[0027] A Placement Group (PG) is a container for storing objects. A storage pool is a logical partition in a distributed file system, a collection of PGs. An object, the smallest unit of data storage, is distributed across various PGs; a single PG holds a large number of objects. RocksDB is a storage engine library based on a key-value pair storage interface. Omap stores object key-value data in RocksDB as key-value pairs. Data reconstruction occurs after a cluster failure, when data redundancy decreases and data is recovered on new OSDs; this data recovery process is called data reconstruction. Additionally, when the cluster is expanded online, data is distributed to the newly expanded nodes; that is, a portion of the data is migrated to the OSDs of the new nodes. This data migration process is also called data reconstruction. Recover is log-based data reconstruction, which can accurately recover data (data objects) modified during the failure period. Backfill is used when the failure time is long and the log cannot record the data modification process during the entire failure period. The data reconstruction method of backfill is to scan all objects in the entire PG and reconstruct the data by comparing which objects are missing and which objects have been deleted.

[0028] The methods and embodiments provided in this application can be executed on a computer terminal or similar computing device. Taking running on a computer terminal as an example, Figure 1 This is a schematic diagram of the hardware environment for an optional metadata reconstruction method according to an embodiment of this application. For example... Figure 1 As shown, a computer terminal may include one or more ( Figure 1Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The computer terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the computer terminal described above. For example, the computer terminal may also include components that are more complex than those described above. Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0029] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the method for determining the adaptability of heat dissipation equipment in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to a computer terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0030] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider for the computer terminal. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0031] Example 1:

[0032] This embodiment provides an example of a metadata reconstruction method. Figure 2 This is a flowchart of an optional metadata reconstruction method according to an embodiment of this application, such as... Figure 2 As shown, the process of this method includes the following steps:

[0033] Step S202: Obtain the first operation log that was not synchronized during the target object storage device failure. The first operation log includes the operation change type corresponding to the business operation on the object data.

[0034] In this embodiment, the target object storage device is an OSD in a distributed file system that requires data reconstruction after a failure (such as a crash or data corruption). Specifically, it is a physical node device that receives incremental OMAP change data from other healthy OSDs and applies it locally to restore metadata. The first operation log refers to the change log dynamically generated and persistently stored in the OSD module for each OMAP-related business operation (setkey, rmkey, omapclear). It contains metadata such as the OMAP key associated with the operation, change type (Insert / Remove / Clear), timestamp, and version number, and is the data foundation for incremental reconstruction. In a distributed file system, object data refers to the smallest data unit stored by the user. Its content (object body) is stored in the data pool, while its descriptive information (such as name, attributes, checksum, etc.) is stored as metadata in the metadata pool in the form of OMAP key-value pairs. This invention focuses on the reconstruction of the metadata part rather than the object body itself. Business operations refer to low-level operation requests initiated by the client and processed by the OSD that modify the omap content. These include three categories: writing / updating keys, deleting keys, and clearing the entire omap. These operations are recorded in real time as the first operation log to support subsequent incremental reconstruction. Operation change type refers to the classification in the omap operation log that identifies the nature of the modification to metadata made by each business operation. It includes three types: Insert (adding or updating a key-value pair), Remove (deleting a key), and OmapClear (clearing the entire omap). It serves as the basis for executing targeted operations during incremental reconstruction.

[0035] In this embodiment, the first operation log that the target object storage device failed to synchronize during the fault is first obtained. This log records the operation change type corresponding to the business operations performed on the object data. That is, each log entry clearly identifies the specific change action of the metadata (omap) of a certain object during the fault period, including types such as write, delete or clear. These change types are the original operation records generated by the system when processing the object metadata update. Its core function is to accurately capture the dynamic changes of the metadata status during the fault, so as to provide a direct basis for subsequent recovery only for the actual changed parts, rather than relying on the full comparison of the complete metadata.

[0036] Step S204: Incrementally reconstruct the local data of the object storage device based on the first operation log.

[0037] In this embodiment, incremental reconstruction of local data on the object storage device based on the first operation log means that during the fault recovery process, the system performs targeted updates only on the metadata entries that changed during the fault, based on the omap key and its change type (setkey, rmkey, or omapclear) contained in the recorded operation log, rather than rewriting the entire omap content. This process directly executes the corresponding data write, key-value deletion, or clear operations in the local storage engine by parsing the incremental change instructions explicitly recorded in the log, thereby synchronizing only the metadata that actually changed, achieving accurate and minimal repair of the local omap data.

[0038] By applying the technical solution of this embodiment, a first operation log that was not synchronized during the failure of the target object storage device is obtained. This operation log clearly records various business operations performed on the object data and their corresponding operation change types, thereby accurately identifying the data changes that occurred during the failure. Based on these operation change types, only the incremental part of the local data affected by the changes is reconstructed, rather than performing a full scan and reconstruction of all metadata objects. By focusing on the incremental data that has actually changed, redundant reading and repeated processing of large-scale metadata are avoided, significantly reducing resource consumption and time overhead during the reconstruction process. This effectively alleviates the system performance bottleneck caused by full reconstruction, quickly restores the metadata consistency of the object storage device, ensures the continuous availability of the business system during the failure recovery period, and ultimately solves the technical problems of low recovery efficiency and business blockage caused by full reconstruction in the prior art.

[0039] Optionally, the business operation includes at least one of the following: object creation, object modification, object deletion, and object attribute change; the operation change type includes at least one of the following: write operation, delete operation, or clear operation; the first operation log also includes the key operation type corresponding to the business operation, and the key operation type includes single-key operation or multi-key batch operation.

[0040] In this embodiment, by clearly defining the business operations recorded in the first operation log as including object creation, object modification, object deletion, and object attribute changes, and limiting the operation change type to write, delete, or clear operations, and introducing key operation types corresponding to the business operations to distinguish between single-key operations and multi-key batch operations, the log can accurately map the complete change behavior at the metadata level. During incremental reconstruction, the system performs targeted processing for each type of change based on the above-mentioned refined operation types and key operation granularity: write for object creation, update for object modification, remove for object deletion, and clear or overwrite fields for object attribute changes. The atomic granularity and concurrency strategy of reconstruction are determined according to the granularity of single-key or batch operations, thereby avoiding misreconstruction caused by ambiguous operation types, and repeated processing or resource waste caused by batch operations being mistakenly split into single keys. This ensures that only actual and identifiable changes are accurately restored, significantly improving the integrity, efficiency, and resource utilization of reconstruction in large-scale metadata scenarios.

[0041] Optionally, before acquiring the first operation log that was not synchronized during the target object storage device failure, the method further includes: when a business operation request for object data is received, recording the operation log of the corresponding business operation request, wherein the business operation request is used to request business operations on the object data.

[0042] In this embodiment, when a business operation request for object data is received, the corresponding operation log is recorded in real time. This ensures that all business change operations are completely and timely captured and persistently stored before the target object storage device fails. This provides a solid data foundation for subsequently obtaining the first operation log that was not synchronized during the failure period. This enables the incremental reconstruction performed based on the first operation log to accurately restore all changes during the failure period, avoiding metadata inconsistencies or reconstruction failures caused by missing or delayed log recording. Ultimately, this achieves efficient and accurate reconstruction of large-scale metadata during the fault recovery process, effectively alleviating business blockage and significantly improving the availability and recovery efficiency of the distributed file system.

[0043] For example, Figure 3This is a flowchart of an optional OMAP operation logging process according to an embodiment of this application. OMAP operation logging is added to the OSD's business request processing flow. First, a data structure for recording OMAP operations is added to the PGLog, including a clear operation flag and key operation records. Logs are recorded for business requests involving OMAP operations, covering three types of business requests: write, delete, or clear operations. When the OSD processes a business request, it determines whether an OMAP operation is involved. If not, the business logic is executed directly. If so, the OMAP operation logging unit is activated, recording key information such as whether the OMAP key operation is single or batch, and the change type. The recorded log data is written to the OMAP operation log database, the OMAP business operation is executed, and the metadata pool is updated.

[0044] Optionally, the first operation log that was not synchronized during the object storage device failure is obtained, including: determining the authoritative log, which is the operation log of the object storage device that is not faulty; comparing and merging the authoritative log with the second operation log of the target object storage device to generate the first operation log, which is the operation log before the target object storage device failure.

[0045] In this embodiment, the operation log of the object storage device that has not experienced a failure is identified as the authoritative log. Combined with the second operation log locally saved by the target object storage device before the failure, the log contents are compared and merged to accurately identify the change operations that the target device did not receive during the failure due to communication interruption or synchronization failure. This generates a first operation log containing only the missing incremental changes. Based on this first operation log, precise incremental reconstruction of the target device's local metadata is performed, avoiding the resource waste and business blockage caused by full reconstruction. At the same time, it ensures that the reconstructed data is completely consistent with other nodes in the cluster. This effectively solves the risks of reconstruction errors, metadata inconsistencies, or missing recovery caused by ambiguous log sources in a distributed environment, and significantly improves the accuracy, efficiency, and overall reliability of metadata recovery.

[0046] Optionally, log comparison and merging are performed based on the authoritative log and the operation log of the currently faulty object storage device, including: if the authoritative log contains a clear operation marker, then all key operation records in the second operation log are cleared; if a key operation record exists in the authoritative log but not in the second operation log, then the record is added to the second operation log; if both the authoritative log and the second operation log contain operation records with the same key, then the operation type in the authoritative log is used as the standard, and the operation record in the second operation log is overwritten.

[0047] In this embodiment, by acquiring the first operation log that was not synchronized during the target object storage device failure, and combining it with the authoritative log maintained in the cluster, consistency correction and incremental repair are performed on the local operation log (i.e., the second operation log) of the faulty node: when there is a clear operation mark in the authoritative log, all key operation records in the second operation log are actively cleared to avoid metadata state disorder caused by local log residue; when there is a key operation record missing from the second operation log in the authoritative log, the record is actively supplemented to restore the complete operation sequence; when there are operation records with the same key but different types in both, the operation type of the authoritative log is used as the basis to overwrite the local record, ensuring that the log content is synchronized with the global consistency state of the cluster. Thus, without relying on full reconstruction, the log inconsistency problem caused by network partition, node failure or synchronization interruption is accurately repaired, and the accurate incremental reconstruction based on the corrected log is finally achieved. This effectively solves the technical problem of metadata recovery errors caused by local log incompleteness or conflict, and significantly improves the recovery efficiency and data consistency guarantee capability of the distributed file system after failure.

[0048] Optionally, embodiments of this application further include: when the first operation log is empty and no clear operation is marked, performing a full reconstruction of the local data of the object storage device.

[0049] In this embodiment, when the target object storage device fails, the first operation log that was not synchronized during the failure period is first obtained. This log records the operation change types of business operations on the object data. If the first operation log is empty and not marked as a clear operation, it indicates that the local metadata may be missing because it was not recorded in the log before the failure. In this case, a full reconstruction is triggered directly, rather than relying on incomplete incremental logs for reconstruction, thereby ensuring that the missing metadata can be fully recovered through the full synchronization mechanism. If the first operation log exists or has been marked as a clear operation, incremental reconstruction is performed to improve efficiency. Through this conditional judgment mechanism, the risk of incomplete metadata caused by missing logs is effectively avoided, and the data loss risk caused by the inability to supplement metadata by incremental reconstruction alone in the case of no change records is solved. This achieves the goal of ensuring metadata integrity and system reliability while ensuring recovery efficiency.

[0050] Optionally, incremental reconstruction of local data on the object storage device is performed based on the first operation log, including: sending the operation change type and corresponding data to the target object storage device for incremental reconstruction, wherein: for write operations, the key of the write operation and its corresponding value are sent; for delete operations, the key of the delete operation and its corresponding value are sent; for clear operations, a clear command is pushed.

[0051] In this embodiment, by acquiring the first operation log of the target object storage device that was not synchronized during the fault, and based on the operation change type recorded therein, the corresponding data content is accurately transmitted in a structured manner according to the operation type: for write operations, only the key and its corresponding value are sent; for delete operations, only the key is sent and the corresponding value is set to null; for clear operations, a clear command is directly pushed, thereby ensuring that the target device only receives and processes the minimum necessary and semantically clear reconstruction commands during the incremental reconstruction process, avoiding reconstruction failure, resource waste, or data inconsistency caused by transmitting redundant or ambiguous data.

[0052] Optionally, embodiments of this application further include: setting a function flag bit, which is used to control whether to perform incremental reconstruction of the local data of the object storage device; when the function flag bit is enabled, performing incremental reconstruction of the local data of the object storage device; when the function flag bit is disabled, performing full reconstruction of the local data of the object storage device.

[0053] In this embodiment, a function flag is set to dynamically control the reconstruction mode of the object storage device during fault recovery. When the function flag is enabled, the system performs incremental reconstruction of local metadata based on the first operation log that was not synchronized during the fault, accurately filling in missing changes and avoiding resource waste and recovery delay caused by full recalculation. When the function flag is disabled, it automatically switches to full reconstruction mode, directly rebuilding local data and avoiding the additional overhead of log parsing and incremental merging. Thus, the optimal recovery strategy is flexibly selected according to the actual scenario such as the size of the storage pool metadata, system load, or business recovery priority. This not only retains the ability to achieve efficient recovery through logs in large-scale metadata scenarios, but also actively avoids unnecessary log processing burdens in small-scale or resource-rich scenarios, effectively balancing recovery efficiency and system overhead. This solves the problems of resource waste or insufficient recovery performance caused by the rigid reconstruction mode and inability to adapt to diverse business environments in traditional solutions.

[0054] Optionally, the function flags can be configured independently for each object storage device and can be started or stopped via command line interface or graphical management interface.

[0055] In this embodiment, by independently configuring function flag bits for each object storage device and supporting remote start-stop control via command-line interface or graphical management interface, operation and maintenance personnel can flexibly choose incremental reconstruction or full reconstruction mode according to the metadata scale, fault recovery window and business priority of each storage device. Differentiated operation and maintenance strategies can be implemented without modifying the underlying reconstruction logic, thereby solving the problem of rigid operation and maintenance and low efficiency caused by the lack of visualization and configurable reconstruction mode switching capabilities in traditional solutions.

[0056] For example, Figure 4This is a flowchart of an optional incremental reconstruction optimization of the Recover process according to an embodiment of this application, which introduces a log parsing and incremental synchronization mechanism. When a cluster failure triggers omap reconstruction, instead of reading the saved omap operation logs, it extracts only the incremental change data that was not synchronized before and after the failure (including newly added keys, modified keys, keys to be deleted, and clear operation instructions), and performs targeted reconstruction based on the change type in the logs: for setkey operations, it synchronizes the addition / update of key-value data; for rmkey operations, it executes the corresponding key deletion; and for omapclear operations, it triggers the rapid clearing of the target omap.

[0057] A new cluster-level function control interface has been added. This interface is deeply integrated with the cluster management software module, allowing administrators to set function on / off flags for specified storage pools (or the entire cluster storage pool) through management platforms (such as the cluster operation and maintenance console or API interface). This flag allows for flexible "on / off" switching of the OMAP incremental reconstruction function: for storage pools with large amounts of metadata and significant reconstruction pressure (such as business pools in massive object storage scenarios), the incremental reconstruction function can be enabled to improve fault recovery efficiency; for scenarios with smaller amounts of metadata and no significant pressure for full reconstruction (such as test environments or small-scale business pools), this function can be disabled to switch back to the traditional full reconstruction mode, balancing adaptability and flexibility for different scenarios and reducing the operation and maintenance costs of technology implementation.

[0058] The OSD refactoring process incorporates log merging, parsing, and application. For example, if an OSD briefly goes offline and then comes back online, peering (a negotiation process among PG members) is triggered. During peering, an authoritative log is generated. By comparing the authoritative log with the local logs of each OSD member, it's possible to determine which objects require refactoring. Ultimately, this log identifies which keys of which objects need refactoring. During the recovery process, when pushing data to OSDs requiring refactoring, the log is parsed to only push the OMAP keys that changed during the failure period to the OSDs requiring refactoring.

[0059] During the refactoring process, to manage each object that needs to be refactored, the information of the refactored object will be stored in an ObjectRecoveryInfo data structure. Two new variables need to be added to this data structure. The new variables are:

[0060] bool need_clear_omap;

[0061] map<string,OmapUpdateType> dirty_omap_keys; / / Records which keys need to be refactored. OmapUpdateType includes two types: Insert and Remove, which indicate which keys are being written and which are being deleted.

[0062] Data pushed to OSDs that need rebuilding is stored in a PushOp. A new variable needs to be added to PushOp: map. <string,pari<OmapUpdateType,bufferlist> > diry_omap_entries; / / Stores which keys need to be refactored and the types and data of OMAP modifications.

[0063] The process is as follows:

[0064] (1) Add a value to the new variable in ObjectRecoveryInfo.

[0065] At the start of the refactoring, the values ​​of omap_had_cleared and dirty_omap_keys in the log are assigned to omap_had_cleared and dirty_omap_keys in ObjectRecoveryInfo.

[0066] (2) Fill PushOp with data based on dirty_omap_keys in ObjectRecoveryInfo.

[0067] Iterate through the dirty_omap_keys of ObjectRecoveryInfo and process each element as follows:

[0068] a. If the OmapUpdateType of the element being iterated over is Insert, call the omap_get_values ​​interface to read the value of this key, and then insert it into the pushOp's diry_omap_entries. For example, if the element being iterated over is push_key, the value read through the omap_get_values ​​interface is stored in out_bl, and then inserted into the pushOp's diry_omap_entries.

[0069] b. If the OmapUpdateType of the element being iterated over is Remove, since only the key needs to be recorded for deletion and the corresponding value (i.e., Omap data) is not needed, it is only necessary to insert the corresponding key and type into diry_omap_entries, and insert an empty bufferlist. At this time, out_bl is an empty bufferlist.

[0070] When an OSD requiring reconstruction receives a data push, it needs to process the local data based on whether the OMAP is undergoing an incremental reconstruction. Since previous OMAP reconstructions were full, the OMAP of the object being reconstructed will be cleared first when the OSD receives the data push. Incremental OMAP reconstruction, however, cannot clear the previous OMAP, otherwise the OMAP will be incomplete. The modification process is as follows:

[0071] (1) The omap is cleared only when the need_clear_omap of ObjectRecoveryInfo is false and the dirty_omap_keys is empty. When the need_clear_omap of ObjectRecoveryInfo is false and the dirty_omap_keys is empty, it is time to perform a full reconstruction.

[0072] (2) When the dirty_omap_keys of ObjectRecoveryInfo is not empty, the incremental omap data that needs to be reconstructed needs to be saved locally.

[0073] a. Iterate through dirty_omap_entries in PushOp and store the Insert and Remove key and value in insert_keys and remove_keys respectively.

[0074] b. When insert_keys is not empty, call the omap_setkeys interface to write incremental omap data locally.

[0075] c. When remove_keys is not empty, call the omap_rmkeys interface to remove the deleted omap keys from the local machine.

[0076] 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. 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 is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the metadata reconstruction method of the various embodiments of this application.

[0077] Embodiments of this application 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 method embodiments when run.

[0078] 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.

[0079] Figure 5 This is a structural block diagram of an electronic device according to an embodiment of this application, such as... Figure 5 As shown, embodiments of this application also provide an electronic device 500, including a processor 501 and a memory 502, wherein the memory 502 stores a computer program, and the processor 501 is configured to run the computer program to perform the steps in any of the above method embodiments.

[0080] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0081] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.

[0082] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0083] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.

Claims

1. A metadata reconstruction method, characterized in that, include: Obtain the first operation log that was not synchronized during the target object storage device failure, the first operation log includes the operation change type corresponding to the business operation on the object data; Incremental reconstruction of the local data of the object storage device is performed based on the first operation log.

2. The method according to claim 1, characterized in that, The business operations include at least one of the following: object creation, object modification, object deletion, and object attribute change; the operation change type includes at least one of the following: write operation, delete operation, or clear operation; the first operation log also includes key operation types corresponding to the business operations, and the key operation types include single-key operations or multi-key batch operations.

3. The method according to claim 1, characterized in that, Before retrieving the first operation log that was not synchronized during the target object storage device failure, the following is also included: When a business operation request for the object data is received, an operation log corresponding to the business operation request is recorded. The business operation request is used to request the business operation to be performed on the object data.

4. The method according to claim 1, characterized in that, The first operation log that was not synchronized during the object storage device failure includes: Determine the authoritative log, which is the operation log of a fault-free object storage device; The authoritative log and the second operation log of the target object storage device are compared and merged to generate the first operation log. The second operation log is the operation log before the failure of the target object storage device.

5. The method according to claim 1, characterized in that, The process of comparing and merging logs based on the authoritative log and the operation logs of the currently faulty object storage device includes: If the authoritative log contains a clear operation flag, then clear all key operation records in the second operation log; If a key operation record exists in the authoritative log but not in the second operation log, then the record is added to the second operation log. If both the authoritative log and the second operation log contain operation records with the same key, the operation type in the authoritative log shall prevail, and the operation record in the second operation log shall be overwritten.

6. The method according to claim 1, characterized in that, Also includes: When the first operation log is empty and no clear operation is marked, the local data of the object storage device is fully reconstructed.

7. The method according to claim 2, characterized in that, The incremental reconstruction of local data on the object storage device based on the first operation log includes: The operation change type and corresponding data are sent to the target object storage device for incremental reconstruction, wherein: For the write operation, send the key of the write operation and its corresponding value; For the deletion operation, the key used to send the deletion operation has an empty value. For the clear operation, a clear command is pushed.

8. The method according to any one of claims 1 to 7, include: Set a function flag bit, which is used to control whether to perform incremental reconstruction of the local data of the object storage device; When the function flag is enabled, the incremental reconstruction is performed on the local data of the object storage device. When the function flag is off, the local data of the object storage device is fully reconstructed.

9. The method according to claim 8, characterized in that, The function flags are configured independently for each object storage device and can be started or stopped via command-line interface or graphical management interface.

10. 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 9.