Distributed metadata remote asynchronous replication method, device and equipment

Through directory anchoring technology and semantic parallel synchronization mode, the problems of low synchronization efficiency and limited deployment patterns of asynchronous remote replication methods in distributed file systems are solved, efficient and instant metadata synchronization is achieved, and heterogeneous deployment is supported.

CN114968966BActive Publication Date: 2025-09-02NEW H3C TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210604933.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-31
Publication Date
2025-09-02
Estimated Expiration
2042-05-31

AI Technical Summary

Technical Problem

In the prior art, the asynchronous remote replication method of distributed file systems has insufficient synchronization efficiency, especially when processing massive metadata, which affects business performance and cannot achieve instant synchronization, and the deployment pattern is limited.

Method used

Directory anchoring technology is used to attribute the metadata modification of the asynchronous remote replication feature directory to the anchor metadata service node, and the concurrent synchronous metadata modification content is extracted from the log file through the semantic parallel synchronization mode, and the semantic conflict is handled in combination with the dual queue mechanism to achieve efficient synchronization.

Benefits of technology

Improve the synchronization efficiency of feature directory metadata, avoid metadata service node migration, support heterogeneous deployment forms, and achieve uninterrupted instant synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114968966B_ABST
    Figure CN114968966B_ABST
Patent Text Reader

Abstract

The present invention provides a distributed metadata remote asynchronous replication method, apparatus, and device for addressing the technical problem of low synchronization efficiency. Based on directory anchoring technology, the present invention attributes metadata modifications to the asynchronous remote replication feature directory to an anchored metadata service node. The metadata log for the asynchronous remote replication feature directory is read from the anchored metadata service node, and metadata modifications are extracted from the metadata log. After semantic conflict resolution, concurrent real-time synchronization is performed. This invention improves the synchronization efficiency of feature directory metadata.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of communications and cloud computing, and in particular to a distributed metadata remote asynchronous replication method, apparatus, and device. Background Art

[0002] Remote replication is a core technology for disaster recovery and backup, and it also forms the foundation for remote data (and metadata) synchronization and disaster recovery. Remote replication leverages the interconnected physical links between physically separate storage nodes to replicate data from the primary to the secondary, maintaining a backup copy of the data on the secondary. In the event of a disaster, data recovery can be performed quickly using the backup data, with minimal data loss. Typically, the secondary also provides data read services during data synchronization.

[0003] Asynchronous remote replication refers to a technology that records the changes made to the write operation after the master receives and processes the write operation. It then sends a completion response to the client and then manually or automatically synchronizes these changes to the slave.

[0004] In order to achieve a good recovery point objective (RPO) and recovery time objective (RTO), the synchronization operation of asynchronous remote replication needs to achieve uninterrupted instant synchronization. For distributed file systems, instant synchronization needs to continuously send metadata modifications to the slave end in the form of synchronization content, and write it to the distributed storage cluster on the slave end. For distributed file systems, metadata modifications under the same asynchronous remote replication directory may be processed on different metadata service nodes. Instant synchronization also needs to perform metadata synchronization concurrently to ensure high synchronization efficiency. For distributed file storage, there is a huge amount of metadata, and it is also necessary to avoid additional recording of modified content that would occupy a large amount of storage space.

[0005] In the existing technology, multiple synchronization programs are deployed on multiple nodes of the master cluster. Each synchronization program contains a client that can access the distributed file system. Through this client, a snapshot of the feature directory that needs to be asynchronously remotely replicated in the distributed file system is taken, and the metadata content of two adjacent snapshot versions is read through the client. The metadata content of the two snapshot versions is compared to form the metadata difference between the two snapshot versions. The difference metadata content is sent to the slave distributed file storage cluster and written, thereby realizing the synchronization of metadata modification content.

[0006] The above metadata synchronization method has a significant impact on business performance. One reason is that dd's intermittent instant synchronization requires continuous snapshot creation. Using the Copy On Write (COW) mechanism to generate a large number of snapshots will bring additional load, and constantly reading different versions of metadata snapshot content will also significantly affect the performance of the distributed cluster. The second reason is that all metadata content in the asynchronous remote replication feature directory under the snapshot version must be traversed and compared one by one to obtain the difference content that needs to be synchronized. For the extremely large directories and massive metadata stored in distributed files, traversing all metadata content is very inefficient, and true uninterrupted instant synchronization cannot be achieved.

[0007] In another distributed metadata synchronization method, a synchronization program continuously reads metadata modification logs generated by the metadata service from the underlying distributed storage of the distributed file system and transmits them to the slave nodes, which are deployed with the same number and type of metadata service nodes. The metadata modification logs are continuously replayed on the corresponding metadata service nodes, ensuring that the slave metadata service nodes are in a completely consistent state with the master metadata service node, achieving instant metadata synchronization.

[0008] In the above solution, the client sends a metadata modification request to the master cluster. The metadata service node of the master cluster receives and processes the metadata modification request, records the metadata modification in a log, and stores the log in a high-speed storage medium. The metadata service then sends a reply to the client indicating that the modification is complete. The asynchronous remote replication synchronization program continuously reads the stored log content and transmits it to the slave. The asynchronous remote replication synchronization program on the slave receives the transmitted metadata modification log and performs the log replay operation on the one-to-one metadata service node to synchronize the metadata status of the slave to a state consistent with that of the master. The deployment forms of the metadata service nodes on the master and slave sides must be isomorphic (one-to-one correspondence).

[0009] Because the metadata service nodes on the slave side constantly replay logs, the metadata content is constantly changing, making it impossible for the metadata service nodes to provide normal metadata services. Consequently, the slave cluster can only provide disaster recovery functionality, but cannot provide file and directory access. Furthermore, due to the single-threaded model of log replay, synchronization efficiency is low. For distributed file systems, massive amounts of metadata, and heavy loads on the metadata service nodes, instant synchronization cannot be achieved. Furthermore, the deployment of the metadata service nodes on the slave cluster must correspond one-to-one with the deployment of the metadata service nodes on the master cluster. Heterogeneous deployments are not supported, limiting deployment options. Summary of the Invention

[0010] In view of this, the present invention provides a distributed metadata remote asynchronous replication method, apparatus and device for solving the technical problem of low synchronization efficiency.

[0011] According to one aspect of an embodiment of the present invention, the present invention provides a distributed metadata remote asynchronous replication method, the method comprising:

[0012] Perform metadata modification operations on the feature directory on the anchor node of the feature directory, where the feature directory is a directory configured with the asynchronous remote replication attribute and the anchor node is a metadata service node that owns the authoritative metadata cache structure of the feature directory and has an anchor identifier set;

[0013] Extract the metadata modifications of the feature directory from the log files generated by the log service on the anchor node, and synchronize the metadata modifications to the slave metadata service node using the semantic parallel synchronization mode.

[0014] Furthermore, the method further comprises:

[0015] When performing a migration operation on a specified directory on an anchor node, recursively determine whether there is an anchor identifier in the metadata cache structure of all upper nodes on the path from the parent directory of the specified directory to the root directory in the directory tree where the specified directory is located, and all lower nodes on the path from the specified directory to the leaf nodes of all branches. If the metadata cache structure of any node has an anchor identifier, the migration operation is blocked.

[0016] Furthermore, the method of extracting the metadata modification content of the feature directory from the log file generated by the log service on the anchor node and synchronizing the metadata modification content to the slave metadata service node using the semantic parallel synchronization mode is as follows:

[0017] Before the log service performs log pruning, it extracts the directory metadata modification content from the log file;

[0018] The extracted metadata modification content is converted into synchronization requests, synchronization requests without semantic conflicts are executed in parallel, and synchronization requests with semantic conflicts are executed serially;

[0019] Based on the first-in-first-out rule, the synchronization request execution completion response is fed back to the log service in the execution order of the synchronization requests to notify the log service to perform log pruning.

[0020] Furthermore, the method of forming synchronization requests with the extracted metadata modification content, executing synchronization requests without semantic conflicts in parallel, and executing synchronization requests with semantic conflicts in serial is as follows:

[0021] Put the synchronization request being executed into the synchronization queue;

[0022] When a new synchronization request for metadata modification content is received, it is determined whether there is a semantic conflict between the new synchronization request and the synchronization request in the synchronization queue;

[0023] When it is determined that there is a semantic conflict, the new synchronization request is added to the waiting synchronization queue and the largest synchronization request identifier among all queue items in the synchronization queue is recorded in the waiting request identifier attribute of the new synchronization request;

[0024] When it is determined that there is no semantic conflict, the new synchronization request is added to the synchronization queue and executed in parallel;

[0025] When a response message to the synchronization request fed back from the end is received, the corresponding queue item in the synchronization queue is dequeued according to the synchronization request identifier in the response message, and a check is made to see whether there is a queue item in the waiting synchronization queue whose waiting request identifier is smaller than the synchronization request identifier in the current response message and the synchronization request identifier in the current response message is already the minimum value in the synchronization queue. The queue item in the waiting synchronization queue that meets the conditions is dequeued and added to the synchronization queue.

[0026] Furthermore, the method for synchronizing the metadata modification content to the slave-end metadata service node is: synchronizing the metadata modification content to multiple distributed file storage clients located at the slave end, so that the multiple distributed file storage clients write the metadata modification content to one or more metadata service nodes at the slave end.

[0027] According to another aspect of an embodiment of the present invention, the present invention further provides a distributed metadata remote asynchronous replication device. The device can be applied to a storage medium of a computing device in the form of a software module, can be applied to a computing device in the form of a hardware module, or can be applied to a computing device in the form of a combination of software and hardware modules. The device includes:

[0028] A modification module is configured to perform a metadata modification operation on a feature directory on an anchor node of the feature directory, wherein the feature directory is a directory configured with the asynchronous remote replication attribute, and the anchor node is a metadata service node that owns the authoritative metadata cache structure of the feature directory and is set with an anchor identifier;

[0029] The synchronization module is used to extract the metadata modification content of the feature directory from the log file generated by the log service on the anchor node, and synchronize the metadata modification content to the slave metadata service node using the semantic parallel synchronization mode.

[0030] Furthermore, the device further comprises:

[0031] The migration judgment module is used to recursively judge whether there is an anchor identifier in the metadata cache structure of all upper nodes on the path from the parent directory of the specified directory to the root directory in the directory tree where the specified directory is located, and all lower nodes on the path from the specified directory to the leaf nodes of all branches when performing a migration operation on the specified directory on the anchor node. If the metadata cache structure of any node has an anchor identifier, the migration operation is blocked.

[0032] Furthermore, the synchronization module includes:

[0033] The extraction module is used to extract the metadata modification content of the directory from the log file before the log service performs log pruning;

[0034] A semantic synchronization module is used to convert the extracted metadata modification content into synchronization requests, execute synchronization requests without semantic conflicts in parallel, and execute synchronization requests with semantic conflicts in serial;

[0035] The synchronization feedback module is used to feed back a synchronization request execution completion response to the log service based on the first-in-first-out rule according to the execution order of the synchronization requests to notify the log service to perform log pruning.

[0036] Furthermore, the synchronization module synchronizes the metadata modification content to multiple distributed file storage clients located at the slave end, so that the multiple distributed file storage clients write the metadata modification content to one or more metadata service nodes at the slave end.

[0037] Based on directory anchoring technology, this invention attributes metadata modifications to the asynchronous remote replication feature directory to an anchored metadata service node. The metadata log for the asynchronous remote replication feature directory is read from the anchored metadata service node, and the metadata modifications are extracted from the metadata log. After semantic conflict resolution, the metadata modifications are synchronized concurrently and instantly. This invention can improve the synchronization efficiency of feature directory metadata. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments of the present invention or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings of the embodiments of the present invention.

[0039] Figure 1 A schematic diagram of an application environment of a distributed metadata remote asynchronous replication method provided by an embodiment of the present invention;

[0040] Figure 2A schematic diagram of a process for implementing metadata modification in a distributed file system based on a log service in one embodiment of the present invention;

[0041] Figure 3 A schematic flow chart of steps for synchronizing metadata modification content using a semantic parallel synchronization mode provided by one embodiment of the present invention;

[0042] Figure 4 A schematic diagram of implementing execution synchronization in a semantic parallel mode using dual queues in one embodiment of the present invention;

[0043] Figure 5 A schematic diagram of the structure of an electronic device for implementing the distributed metadata remote asynchronous replication method provided by an embodiment of the present invention is provided. DETAILED DESCRIPTION

[0044] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the embodiments of the present invention. The singular forms "a," "the," and "the" used in the embodiments of the present invention are also intended to include plural forms, unless the context clearly indicates otherwise. The term "and / or" used in the present invention refers to any or all possible combinations of one or more associated listed items.

[0045] It should be understood that although the terms "first," "second," "third," etc. may be used to describe various information in embodiments of the present invention, such information should not be limited to these terms. These terms are merely used to distinguish information of the same type from one another. For example, without departing from the scope of embodiments of the present invention, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the term "if" may also be interpreted as "when," "when," or "in response to determining."

[0046] The two typical instant synchronization methods used by asynchronous remote replication in distributed file systems rely on either snapshot creation or log replay. The snapshot method requires continuous snapshot creation and replaying all metadata in the snapshot version directory. This is inefficient for large directories and massive amounts of metadata in distributed file storage. The log method requires continuous log replay, preventing the slave from providing normal metadata services. Single-threaded replay is inefficient and restricts cluster deployment.

[0047] The purpose of the present invention is to provide a distributed metadata remote asynchronous replication method, which can achieve efficient synchronization of metadata of a directory (referred to as a feature directory) with an asynchronous remote replication feature set in a distributed file system. The basic idea of ​​the present invention is: based on the directory anchoring technology, all metadata modifications of the asynchronous remote replication feature directory are attributed to the anchor metadata service node, the metadata log of the asynchronous remote replication feature directory is read from the anchor metadata service node, the metadata modification content is extracted from the metadata log, and then the semantic conflict is processed and synchronized concurrently. The present invention can improve the synchronization efficiency of the feature directory metadata. Based on the basic idea of ​​the present invention, the specific implementation method of the technical solution of the present invention is described in detail below in combination with the embodiments.

[0048] Figure 1 A schematic diagram of the application environment of the distributed metadata remote asynchronous replication method provided by one embodiment of the present invention. An asynchronous remote replication relationship is established between the metadata service node in the master-side distributed file storage cluster and the metadata service node in the slave-side distributed file storage cluster, and the master-slave distributed file storage clusters can be heterogeneous. The master-side feature directory needs to use directory anchoring technology to anchor the feature directory to a metadata service node on the master side, for example, feature directory 1 is anchored to metadata service node 1. The following describes the specific implementation steps of the distributed metadata remote asynchronous replication method provided by the present invention, taking the master-side metadata service node as the execution subject:

[0049] Step S10: Performing a metadata modification operation on the feature directory on the anchor node of the feature directory, wherein the feature directory is a directory configured with the asynchronous remote replication attribute, and the anchor node is a metadata service node that owns the authoritative metadata cache structure of the feature directory and is set with an anchor identifier;

[0050] In a distributed file storage cluster that processes large amounts of data, multiple metadata service nodes are usually deployed. In order to balance the load between multiple metadata service nodes, a directory migration mechanism is usually enabled. When one or some directories in the metadata service node that enables the directory migration mechanism meet the migration conditions, the metadata cache content corresponding to these directories will be migrated from one metadata service node to another metadata service node with a lighter load, and the metadata caches of the subfiles and subdirectories under these directories will also be migrated to other metadata service nodes. During migration, the metadata of the directory will be migrated based on the subtree as the basic unit, and the root of the subtree is a directory metadata structure. In order to prevent the characteristic directory from being migrated, the present invention proposes a directory anchoring technology.

[0051] In a distributed file storage cluster, there are multiple copies of metadata in the caches of multiple metadata service nodes, among which only one metadata copy of a metadata service node can accept and process metadata modification requests. The metadata copy on this metadata service node is called the authoritative metadata copy, and other metadata service nodes are synchronized based on the authoritative metadata copy. In the present invention, the metadata copy that can accept modification in the metadata copy of the feature directory in the distributed file system is called the authoritative metadata copy of the feature directory, and the metadata cache structure of the feature directory in the authoritative metadata copy is called the authoritative metadata cache structure of the feature directory. In a distributed file storage cluster, in order to realize asynchronous remote replication of metadata for a specified directory, it is necessary to configure asynchronous remote replication attributes for the specified directory. In the present invention, the directory configured with asynchronous remote replication attributes is referred to as the feature directory.

[0052] In one embodiment of the present invention, an anchor identifier is set for the authoritative metadata cache structure of a feature directory to prevent the metadata of the feature directory from being migrated to other metadata service nodes. Specifically, when performing a migration operation on a specified directory on an anchor node, a recursive check is performed to determine whether the metadata cache structures of all upper nodes on the path from the parent directory of the specified directory to the root directory in the directory tree where the specified directory is located, as well as all lower nodes on the path from the specified directory to the leaf nodes of all branches, contain an anchor identifier. If the metadata cache structure of any node contains an anchor identifier, a result indicating that the migration cannot be performed is returned to the caller of the migration operation, thereby preventing the migration operation.

[0053] This invention restricts subtree migration by setting an anchor identifier on the authoritative metadata cache structure of the feature directory. Metadata modifications for all directories and files under the feature directory can only occur on the anchored metadata service node. This directory anchoring technology ensures that all modification requests for directories and files under the feature directory are processed by the anchored metadata service node, thus preventing metadata from migrating between metadata service nodes and preventing coordinated and orderly concurrent synchronization.

[0054] In addition to the above-mentioned method of anchoring a specified directory to a specified metadata service node by adding an anchor mark to the metadata cache structure, it can also be achieved by using a database or other data structure type to record the anchored directory. As long as the functional purpose of directory anchoring can be achieved, the present invention does not make specific limitations.

[0055] Step S11: extract the metadata modification content of the feature directory from the log file generated by the log service on the anchor node, and synchronize the metadata modification content to the slave metadata service node using the semantic parallel synchronization mode.

[0056] Figure 2The present invention is a schematic diagram of the processing process of metadata modification implemented by the distributed file system based on the log service in one embodiment of the present invention. When the operating system of the metadata service node writes data, the written file data and directory metadata modification content will first be written to the log file through the log service, and then asynchronously refreshed from the log file to the backend storage pool by other threads. When a cluster failure occurs, the unflushed content is first read from the log file, replayed into the memory, and then refreshed to the backend storage pool by the background thread. Taking the CentOS operating system as an example, there are two log services in CentOS, namely rsyslog and systemd-journal. Systemd-journal (abbreviated as Journal) is an improved log management service that can collect logs from the kernel, the early startup stage of the system, the standard output and error information of the system daemon during startup and operation, and the syslog log. Log files are usually persistently stored in high-speed storage media such as solid-state drives (SSDs) and non-volatile interface NVMe storage media.

[0057] An embodiment of the present invention provides a method for synchronizing metadata modification content of a feature directory to a slave metadata service node using a semantic parallel synchronization mode on a metadata service node of a distributed file storage cluster, including:

[0058] Step S21: Before the log service executes log pruning, the metadata modification content of the directory is extracted from the log file;

[0059] Figure 2 In the example, the steps for the master end of remote asynchronous replication to prune log segments and release log segment space after receiving a data processing request to the log service include:

[0060] Step 1: The metadata service node receives a metadata modification request from the storage service client; the metadata modification request carries the metadata modification content;

[0061] Step 2: The metadata modification content is recorded in the log segment of the log file through the log service. The log segment is usually located in a high-speed persistent storage medium.

[0062] Step 3: Extract the metadata modification content in the log segment and update it to the metadata memory cache of the metadata service node, and mark the metadata cache structure in the memory cache as a dirty metadata cache structure;

[0063] Step 4: Enqueue the dirty metadata cache structure into the dirty metadata queue in memory;

[0064] Step 5: Traverse the dirty metadata queue and flush the dirty metadata cache structure to the low-speed persistence space;

[0065] Step 6: After flushing the dirty metadata cache structure, perform the metadata modification content synchronization processing in the aforementioned semantic parallel mode. After receiving a successful response from the slave, the log service can release the log segment space storing the dirty metadata cache structure in the log space.

[0066] The present invention refers to the operation of releasing the log segments of the log file that have completed the dirty metadata flushing process by the log service as log pruning. Based on the combination of characteristic directory anchoring technology, the embodiment of the present invention forms a synchronization request of the dirty metadata modification content and sends it to the slave end in a semantic parallel mode before the log service executes log pruning. The slave end writes the metadata modification content into the slave end distributed file system. The master end will execute the corresponding log pruning operation only after receiving the synchronization success response message fed back by the slave end. The use of the semantic parallel mode to send the directory metadata modification synchronization request to the slave end can ensure that the synchronization request is executed concurrently on the slave end, thereby achieving high synchronization efficiency.

[0067] The contents of the dirty metadata queue items typically include: the metadata content of the modified inode (including the metadata index number ino, user ID uid, user group ID gid, open mode mode, modification time mtime, creation time ctime, access time atime, file size size, and extended attributes xattrs), the full path of the modified inode (the full path string from the inode node to the root node), and the delete mark and original path of the deleted or renamed inode. Inode refers to the metadata index node, which contains the metadata content itself and stores all the metadata content of a file or directory. The ino number is the unique number of the inode and can be used to retrieve the inode on the metadata server.

[0068] Due to the limitations of the Journal's stored content (it does not store the client's metadata request operation type (OpType), only the entire content of the modified metadata and the deletion marker), before the Journal is pruned, the operation types that result in metadata modification (CREATE, REMOVE, RENAME, SETATTR, SETXATTR, RMXATTR, etc.) are no longer available. "Setting attributes" refers to setting attribute values ​​other than extended attributes (xattrs). "Extended attributes" refers to a map structure containing multiple string-type key / value pairs. Users can insert and delete corresponding key / value pairs. "Setting extended attributes" refers to inserting an extended attribute key / value pair, and "deleting extended attributes" refers to deleting an extended attribute key / value pair.

[0069] Before the Journal performs log pruning, it can obtain the modified metadata content (including the path, etc.), the mark of the deleted metadata, and the original path. If the Journal log content is generated by a RENAME operation, the corresponding metadata content is the metadata content on the new path generated by the RENAME operation, and the mark of the metadata on the original path deleted by the RENAME operation, as well as the original path. For the sake of simplicity, the present invention refers to the metadata changes generated by operations that can cause directory metadata changes (such as adding, modifying, deleting, renaming, modifying attributes of directories or files) as metadata modification content.

[0070] Before executing step ⑥, one embodiment of the present invention extracts the directory metadata modification content (including path, etc.) from the log segment of the log file. Only after the log pruning conditions of the log service are met and the metadata modification content is successfully synchronized to the slave end, the journal log pruning processing of step ⑥ is executed. Otherwise, the pruning operation is not performed, thereby ensuring the synchronization and consistency of the metadata modifications on the master and slave ends.

[0071] Step S22: The extracted metadata modification content is converted into a synchronization request. The extracted metadata modification content of the directory is processed in a semantically parallel manner. The metadata modification content is synchronized to the slave metadata service node using a semantically parallel synchronization mode. After the synchronization is completed, the log service is notified to perform the corresponding log pruning.

[0072] In this embodiment of the present invention, the mode in which directory metadata modifications that do not cause semantic conflicts are synchronized to the slave in parallel, while directory metadata modifications that do cause semantic conflicts are synchronized to the slave serially, is called semantic parallel synchronization mode. This mode, i.e., a synchronization mode that synchronizes semantics in parallel and serially within semantics, ensures that after synchronization requests are sent to the remote end, synchronization requests that do not cause semantic conflicts can be executed concurrently on the slave, thereby improving the efficiency of remote asynchronous replication.

[0073] The present invention refers to the situation where the metadata modification contents of two directories have a prefix matching relationship in the metadata path as semantic correlation. The situation where the synchronization results of the metadata modification contents of two semantically related directories are erroneous or inconsistent with the master end due to synchronization timing errors is called a semantic conflict. For example, two metadata modification operations, due to the semantics of the modification itself, the two operations are executed in different orders, and the results produced are different. Taking synchronization request A: create directory "dir / " and synchronization request B: create file "dir / file" as an example, the synchronization is performed in the order of A first and then B, and the synchronization result obtained on the slave end is the dir / file metadata structure; if the synchronization is performed in the order of B first and then A, an erroneous result will be produced, resulting in a synchronization failure, because semantically, the slave end cannot create the file "dir / file" without creating the directory "dir / ".

[0074] Figure 3 A flowchart illustrating the steps for synchronizing metadata modification content using a semantic parallel synchronization mode is provided in accordance with an embodiment of the present invention. The flowchart assumes that a first synchronization request and a second synchronization request are received in sequence, and that the second synchronization request is received while the first synchronization request is being executed. The flowchart includes:

[0075] Step 301: Receive a second synchronization request, which includes the second directory metadata modification content;

[0076] Step 302: Determine whether there is a semantic conflict with the first synchronization request. If there is a semantic conflict, execute step 303; otherwise, execute step 306.

[0077] Step 303: Wait for a successful response to the first synchronization request;

[0078] Step 304: Determine whether a successful response to the first synchronization request is received. If so, proceed to step 305; otherwise, return to step 303 and continue waiting.

[0079] Step 305: Send a second synchronization request;

[0080] Step 306: While executing the first synchronization request, execute the second synchronization request in parallel.

[0081] The synchronization strategy of the semantic parallel synchronization mode provided by the present invention complies with the following principles:

[0082] Principle 1: Parallel execution of synchronous requests that do not have semantic conflicts;

[0083] Principle 2: Synchronous requests with semantic conflicts are executed serially according to the dependency relationship. That is, in the case of a semantic conflict, the synchronization of the dependent synchronization request is executed first according to the dependency relationship. After the dependent synchronization request successfully responds, the synchronization request that depends on it is immediately executed.

[0084] Principle 3: Feedback synchronization request completion responses to the log service based on the first-in, first-out rule in the order in which synchronization requests are executed (not the order in which successful responses are received) to notify the log service to perform log pruning.

[0085] Figure 4The following is a schematic diagram of an embodiment of the present invention that uses dual queues to implement semantic parallel mode execution synchronization. In the metadata service node of the distributed storage cluster on the master side, a "synchronizing queue" WKseq and a "waiting synchronization queue" WTseq are set. One of the main functions of WTseq is to resolve semantic conflict problems. Each synchronization request will be assigned a synchronization request id, that is, each queue item in WKseq and WTseq includes a request id, but each queue item in WTseq also includes an additional "waiting request id" attribute. The "waiting request id" is used to identify that the synchronization request in the queue item needs to wait for the synchronization request identified by the "waiting request id" to be completed before it can be executed. The specific steps for implementation are as follows:

[0086] Step 401: Put the synchronization request being executed, i.e., the synchronization request that has been sent to the slave end but has not received a completion response, into the synchronization queue WKseq;

[0087] When there is no queue item in the WTseq queue, the newly arrived synchronization request containing metadata modification content can be directly placed in the WKseq queue.

[0088] The synchronization request in the synchronization queue WKseq can execute synchronization operations in parallel through multiple threads.

[0089] Step 402: When a new synchronization request for metadata modification is received, determine whether there is a semantic conflict between the new synchronization request and the synchronization requests in the WKseq queue;

[0090] If the path of the metadata modification content in the new synchronization request (the first path) and the path of the metadata modification content in the synchronization request being checked (the second path) have a prefix match, it indicates a semantic conflict between the two. The prefix match relationship includes two cases: the first path is a prefix of the second path string, and the second path string is a prefix of the first path string.

[0091] Step 403: When it is determined that there is a semantic conflict, the new synchronization request is added to the "waiting synchronization queue" WTseq and the largest synchronization request ID among all queue items in the WKseq queue is recorded in the "waiting request ID" attribute of the new synchronization request.

[0092] Step 404: When it is determined that there is no semantic conflict, the new synchronization request is added to the WKseq queue and executed in parallel;

[0093] Step 405. When a response message to the synchronization request fed back from the end is received, the corresponding queue item in the synchronization queue WKseq is dequeued according to the synchronization request id in the response message, and a check is made to see whether there is a queue item in the waiting synchronization queue WTseq whose "waiting request id" is smaller than the synchronization request id in the current response message and the synchronization request id in the current response message is already the minimum value in the synchronization queue WKseq. The queue items in the waiting synchronization queue WTseq that meet the above conditions are dequeued and added to the synchronization queue WKseq.

[0094] The access node of the slave distributed storage cluster concurrently writes the metadata modifications synchronized from the master to the distributed storage cluster through the distributed file storage client. After receiving the synchronization request, the slave will write the metadata modifications in the synchronization request according to the updated metadata path and updated metadata content through the client of the slave distributed file storage cluster based on the metadata modification content in the synchronization request. If the metadata modification content is an update type (including the path), the updated metadata path and updated metadata content will be written to the slave distributed file storage cluster through the client of the slave distributed file storage cluster. If the metadata tag (and path) is a deletion type, the metadata will be deleted from the slave distributed file storage cluster through the client of the slave distributed file storage cluster based on the deleted metadata path.

[0095] like Figure 1 As shown, the slave side can configure multiple distributed file storage clients to receive synchronization requests from the master side. The slave side cluster can implement a deployment form or structure different from the master side cluster. For example, the master side includes n metadata service nodes and the slave side includes m metadata service nodes.

[0096] The present invention realizes a method for uninterrupted instant synchronization of metadata in asynchronous remote replication of a distributed file storage system. At multiple metadata service nodes on the master side, the asynchronous replication feature directory is anchored on a fixed metadata service node using directory anchoring technology, and metadata modification content is extracted from the log generated by the log service in the anchor node, and synchronized to the slave side in real time and uninterruptedly. At the metadata service node on the master side, semantic parallelization is also performed on the synchronization request to ensure high efficiency of synchronization. At the slave side, through the client of the distributed file storage, the metadata modification content is written to the distributed file storage cluster on the slave side, avoiding restrictions on the deployment form of the distributed file storage cluster on the slave side.

[0097] Figure 5This is a schematic diagram of the structure of an electronic device for implementing the distributed metadata remote asynchronous replication method provided in one embodiment of the present invention. The device 500 includes a processor 510, such as a central processing unit (CPU), a communication bus 520, a communication interface 540, and a storage medium 530. The processor 510 and the storage medium 530 can communicate with each other via the communication bus 520. The storage medium 530 stores a computer program. When executed by the processor 510, the computer program can implement the functions of one or more steps of the distributed metadata remote asynchronous replication method provided in the present invention.

[0098] The storage medium may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk storage. In addition, the storage medium may also be at least one storage device located away from the aforementioned processor. The processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component.

[0099] It should be appreciated that embodiments of the present invention can be implemented or implemented by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory memory. The method can be implemented in a computer program using standard programming techniques, including a non-transitory storage medium configured with a computer program, wherein the storage medium configured in this manner causes the computer to operate in a specific and predefined manner. Each program can be implemented in a high-level procedural or object-oriented programming language to communicate with the computer system. However, if necessary, the program can be implemented in assembly or machine language. In any case, the language can be a compiled or interpreted language. In addition, for this purpose, the program can be run on a programmed application-specific integrated circuit. In addition, the operations of the process described in the present invention can be performed in any suitable order, unless otherwise indicated by the present invention or otherwise clearly contradicted by the context. The process described in the present invention (or variations and / or combinations thereof) can be executed under the control of one or more computer systems configured with executable instructions and can be implemented as code (e.g., executable instructions, one or more computer programs, or one or more applications) that is executed collectively on one or more processors, by hardware or a combination thereof. The computer program includes multiple instructions that can be executed by one or more processors.

[0100] Furthermore, the methods can be implemented in any type of computing platform that is operably connected to a suitable computer, including but not limited to a personal computer, a minicomputer, a mainframe, a workstation, a network or distributed computing environment, a separate or integrated computer platform, or in communication with a charged particle tool or other imaging device, etc. Various aspects of the present invention can be implemented as machine-readable code stored on a non-transitory storage medium or device, whether removable or integrated into a computing platform, such as a hard disk, an optical read and / or write storage medium, RAM, ROM, etc., so that it can be read by a programmable computer, and when the storage medium or device is read by the computer, it can be used to configure and operate the computer to perform the processes described herein. In addition, the machine-readable code, or portions thereof, can be transmitted over a wired or wireless network. When such media includes instructions or programs that implement the steps described above in conjunction with a microprocessor or other data processor, the invention described herein includes these and other different types of non-transitory computer-readable storage media. When programmed according to the methods and techniques of the present invention, the present invention also includes the computer itself.

[0101] The foregoing is merely an embodiment of the present invention and is not intended to limit the present invention. It will be apparent to those skilled in the art that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. A distributed metadata remote asynchronous replication method, characterized in that: The method includes: Perform metadata modification operations on the feature directory on the anchor node of the feature directory, where the feature directory is a directory configured with the asynchronous remote replication attribute and the anchor node is a metadata service node that owns the authoritative metadata cache structure of the feature directory and has an anchor identifier set; The metadata modification content of the feature directory is extracted from the log file generated by the log service on the anchor node, and the metadata modification content is synchronized to the slave metadata service node using the semantic parallel synchronization mode. The semantic parallel synchronization mode is a mode in which metadata modification content that does not cause semantic conflicts is synchronized to the slave in parallel, and metadata content that causes semantic conflicts is synchronized to the slave in serial.

2. The method according to claim 1, characterized in that The method further comprises: When performing a migration operation on a specified directory on an anchor node, recursively determine whether there is an anchor identifier in the metadata cache structure of all upper nodes on the path from the parent directory of the specified directory to the root directory in the directory tree where the specified directory is located, and all lower nodes on the path from the specified directory to the leaf nodes of all branches. If the metadata cache structure of any node has an anchor identifier, the migration operation is blocked.

3. The method according to claim 1, characterized in that The method for extracting metadata modification content of the feature directory from the log file generated by the log service on the anchor node and synchronizing the metadata modification content to the slave metadata service node using the semantic parallel synchronization mode is as follows: Before the log service performs log pruning, it extracts the directory metadata modification content from the log file; The extracted metadata modification content is converted into synchronization requests, synchronization requests without semantic conflicts are executed in parallel, and synchronization requests with semantic conflicts are executed serially; Based on the first-in-first-out rule, the synchronization request execution completion response is fed back to the log service in the execution order of the synchronization requests to notify the log service to perform log pruning.

4. The method according to claim 3, characterized in that The method of forming the extracted metadata modification content into synchronization requests, executing the synchronization requests without semantic conflicts in parallel, and executing the synchronization requests with semantic conflicts in series is as follows: Put the synchronization request being executed into the synchronization queue; When a new synchronization request for metadata modification content is received, it is determined whether there is a semantic conflict between the new synchronization request and the synchronization request in the synchronization queue; When it is determined that there is a semantic conflict, the new synchronization request is added to the waiting synchronization queue and the largest synchronization request identifier among all queue items in the synchronization queue is recorded in the waiting request identifier attribute of the new synchronization request; When it is determined that there is no semantic conflict, the new synchronization request is added to the synchronization queue and executed in parallel; When a response message to the synchronization request fed back from the end is received, the corresponding queue item in the synchronization queue is dequeued according to the synchronization request identifier in the response message, and a check is made to see whether there is a queue item in the waiting synchronization queue whose waiting request identifier is smaller than the synchronization request identifier in the current response message and the synchronization request identifier in the current response message is already the minimum value in the synchronization queue. The queue item in the waiting synchronization queue that meets the conditions is dequeued and added to the synchronization queue.

5. The method according to claim 1, characterized in that The method for synchronizing the metadata modification content to the slave-end metadata service node is: synchronizing the metadata modification content to multiple distributed file storage clients located at the slave end, so that the multiple distributed file storage clients write the metadata modification content to one or more metadata service nodes at the slave end.

6. A distributed metadata remote asynchronous replication device, characterized in that: The device comprises: A modification module is configured to perform a metadata modification operation on a feature directory on an anchor node of the feature directory, wherein the feature directory is a directory configured with the asynchronous remote replication attribute, and the anchor node is a metadata service node that owns the authoritative metadata cache structure of the feature directory and is set with an anchor identifier; The synchronization module is used to extract the metadata modification content of the feature directory from the log file generated by the log service on the anchor node, and synchronize the metadata modification content to the slave metadata service node using the semantic parallel synchronization mode. The semantic parallel synchronization mode is a mode in which metadata modification content that does not cause semantic conflicts is synchronized to the slave in parallel, and metadata content that causes semantic conflicts is synchronized to the slave in serial.

7. The device according to claim 6, characterized in that The device further comprises: The migration judgment module is used to recursively judge whether there is an anchor identifier in the metadata cache structure of all upper nodes on the path from the parent directory of the specified directory to the root directory in the directory tree where the specified directory is located, and all lower nodes on the path from the specified directory to the leaf nodes of all branches when performing a migration operation on the specified directory on the anchor node. If the metadata cache structure of any node has an anchor identifier, the migration operation is blocked.

8. The device according to claim 6, characterized in that The synchronization module includes: The extraction module is used to extract the metadata modification content of the directory from the log file before the log service performs log pruning; A semantic synchronization module is used to convert the extracted metadata modification content into synchronization requests, execute synchronization requests without semantic conflicts in parallel, and execute synchronization requests with semantic conflicts in serial; The synchronization feedback module is used to feed back a synchronization request execution completion response to the log service based on the first-in-first-out rule according to the execution order of the synchronization requests to notify the log service to perform log pruning.

9. The device according to claim 6, characterized in that The synchronization module synchronizes the metadata modification content to multiple distributed file storage clients located at the slave end, so that the multiple distributed file storage clients write the metadata modification content into one or more metadata service nodes at the slave end.

10. An electronic device, characterized in that: It includes a processor, a communication interface, a storage medium and a communication bus, wherein the processor, the communication interface and the storage medium communicate with each other via the communication bus; Storage medium for storing computer programs; A processor, configured to implement the method steps according to any one of claims 1 to 5 when executing a computer program stored on a storage medium.

Citation Information

Patent Citations

  • Cross-site remote copy implementation method

    CN108334561A

  • Distributed file system remote copying method, device, equipment and medium

    CN112749141A