A boolean network-based distributed file system consistency method

CN123011832APending Publication Date: 2026-10-30SICHUAN HUACUNZHIGU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611517608.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-29
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0003]现有分布式文件系统的元数据一致性方案中,元数据状态的合法性判定多基于预设规则或版本号比较,缺乏对元数据状态之间逻辑关联关系的形式化刻画,难以全面描述元数据状态的合法状态范围,导致元数据状态合法性判定的依据不够明确

Benefits of technology

(1)通过将文件元数据状态位映射为布尔网络节点并构建元数据布尔网络,以吸引子与吸引域刻画合法状态空间,使元数据状态的合法性判定具备形式化依据,为分布式一致性维护提供明确判定标准;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123011832A_ABST
    Figure CN123011832A_ABST
Patent Text Reader

Abstract

The application discloses a kind of distributed file system consistency methods based on Boolean network, belong to distributed storage field.The method carries out state bit extraction to file metadata in distributed file system, state bit is mapped as Boolean network node to construct metadata Boolean network, define update function for each Boolean network node and obtain legal state space by evolution calculation attractor and attraction domain, metadata Boolean network state is coded as state vector, and state is exchanged and merged between distributed nodes, after merging, state input metadata Boolean network executes update and checks whether in legal state space, for the abnormal state outside attraction domain, it is restored to attractor by executing recovery operation.The application makes metadata state legality determination have formal basis, inconsistent situation is identified in time during state synchronization process, and abnormal state is automatically restored, guaranteeing distributed file system metadata state consistency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of distributed storage, and in particular to a distributed file system consistency method based on Boolean networks. Background Technology

[0002] Distributed file systems (DFS) achieve distributed storage and concurrent access to file data by distributing file data and metadata across multiple nodes. File metadata describes file attributes and operational states, including various types such as file lock status, permission holding status, open handle status, directory entry status, transaction status, verification status, and version synchronization status. Maintaining metadata consistency in a DFS typically employs methods like master-slave replication, consensus protocols, version vectors, and anti-entropy protocols to propagate and synchronize metadata states between nodes. Metadata state transitions are constrained by file operation semantics; different metadata states have logical relationships, and the execution of file operations triggers metadata state transitions. During operation, a DFS continuously maintains the consistency of metadata states across nodes to ensure the correct execution of file operations.

[0003] In existing distributed file system metadata consistency schemes, the validity of metadata states is often determined based on preset rules or version number comparisons. This lacks a formal characterization of the logical relationships between metadata states, making it difficult to comprehensively describe the range of valid metadata states and resulting in unclear criteria for determining validity. When synchronizing metadata states between distributed nodes, the merged metadata states lack a validity verification mechanism based on a state space structure. This makes it difficult to identify inconsistencies in metadata states during synchronization, potentially leading to further propagation of inconsistent states between nodes. Furthermore, existing solutions lack a target state selection criterion and execution order constraint based on a state space structure when inconsistent metadata states occur. The recovery process may cause unnecessary modifications to the metadata states, and the recovered state lacks a mechanism for automatic convergence to a valid state. Summary of the Invention

[0004] The purpose of this invention is to overcome the shortcomings of the prior art and provide a distributed file system consistency method based on Boolean networks.

[0005] The objective of this invention is achieved through the following technical solution: A consensus method for distributed file systems based on Boolean networks is provided, which includes the following steps: S1. Extract the status bits from the file metadata in the distributed file system, map the status bits contained in the file metadata to Boolean network nodes, and each Boolean network node takes a Boolean value to obtain the metadata Boolean network. S2. Define an update function for each Boolean network node in the metadata Boolean network. The update function takes the current state of all Boolean network nodes and the external input vector as independent variables. Evolve the metadata Boolean network through the update function, calculate the attractors and attraction domains of the metadata Boolean network, and obtain the legal state space. S3. Encode the metadata Boolean network state into a state vector, exchange the state vectors between distributed file system nodes, merge the exchanged state vectors, input the merged state into the metadata Boolean network to perform an update to obtain the updated state, and check whether the updated state is within the valid state space. S4. Perform an attraction domain check on the updated state, mark states outside the attraction domain as abnormal states, perform a recovery operation on abnormal states, and restore the abnormal states to the attractor.

[0006] Furthermore, the state bit extraction and Boolean network node mapping in step S1 includes the following sub-steps: S1.1. Extract status bits from file metadata. Status bits include file locked status, write permission held status, read permission held status, open handle valid status, directory entry valid status, transaction in progress status, data block verification valid status, and metadata version synchronization status. S1.2. Map each state bit to a Boolean network node. The Boolean network node takes the value of a first Boolean value or a second Boolean value. The first Boolean value corresponds to the active state of the state bit, and the second Boolean value corresponds to the inactive state of the state bit. S1.3. Perform threshold mapping on the Boolean network nodes corresponding to the counting status bits. The counting status bits include the open handle count and the number of readers. Compare the count value of the counting status bits with the set value. When the count value is greater than the set value, map the value of the Boolean network node corresponding to the counting status bit to the first Boolean value. When the count value is equal to the set value, map the value of the Boolean network node corresponding to the counting status bit to the second Boolean value. S1.4. Combine all Boolean network nodes that have undergone threshold mapping into a metadata Boolean network according to their file metadata affiliation.

[0007] Furthermore, the update function definition and attractor calculation in step S2 include the following sub-steps: S2.1. Define an update function for each Boolean network node. The update function takes the current state of all Boolean network nodes and the external input vector as independent variables. The update function outputs the Boolean value of the corresponding Boolean network node at the next time step. The update function is derived from the constraint rules of file metadata state transition. The update function is represented in disjunctive normal form. S2.2. An asynchronous update mode is adopted to evolve the metadata Boolean network through an update function. Each Boolean network node triggers an update based on its own state change, without using a global clock for synchronous updates. S2.3. Starting from each initial state of the metadata Boolean network, iterate and evolve in an asynchronous update mode until entering a loop, recording all attractors. Attractors include single-point attractors and limit cycles. Single-point attractors correspond to the stable no-operation state of the file metadata, and limit cycles correspond to the periodic operation state of the file metadata. S2.4. Calculate the attraction domain for each attractor. The attraction domain is the set of initial states that eventually enter the corresponding attractor after evolution. The states inside the attraction domain are legal transition states, and the states outside the attraction domain are abnormal states.

[0008] Furthermore, the state vector exchange and merging in step S3 includes the following sub-steps: S3.1. Encode the metadata Boolean network state into a state vector, where each bit of the state vector corresponds to the value of a Boolean network node, and append a version number and node identifier to the state vector; S3.2. Exchange state vectors periodically between nodes of the distributed file system via the gossip protocol, with the exchange period being a set value; S3.3. Compare the version numbers of the received state vector and the local state vector, and take the state vector with the larger version number as the base state vector; S3.4. When the received state vector has the same version number as the local state vector, perform a logical OR operation on the received state vector and the local state vector according to the state bits, and use the result of the logical OR operation as the value of the corresponding state bit in the merged state; when the received state vector has a different version number from the local state vector, use the base state vector as the merged state. S3.5. Input the merged state into the metadata boolean network and perform an asynchronous update to obtain the updated state. Check whether the updated state is within the valid state space. If it is within the valid state space, update the local state and increment the version number. If it is outside the valid state space, trigger the abnormal state recovery process.

[0009] Furthermore, the abnormal state detection and recovery in step S4 includes the following sub-steps: S4.1. After each metadata Boolean network state update or state vector merging, check whether the current state is within the attraction domain of any attractor; S4.2. Mark states outside the attraction domain as abnormal states, record the abnormal state vector and triggering operation. Abnormal states include locked but no writer state, deleted file still has open handle state, and transaction state but version is outdated. S4.3. Calculate the Hamming distance from the abnormal state to all attractors, and select the attractor with the smallest Hamming distance as the target state to be recovered; S4.4. Determine the set of Boolean network nodes that need to be flipped between the abnormal state and the recovery target state. Flip the Boolean network node values ​​in the order of the update function constraints. After each flip, check whether the state has entered the attraction domain. S4.5. After the Boolean network node completes the value flip and the state enters the attraction domain, it broadcasts the restored state vector to notify other nodes in the distributed file system to synchronize the state.

[0010] Furthermore, in step S1, the count value of the count class status bit is maintained locally. The precise value of the count value is maintained locally by the distributed file system node. The metadata Boolean network only maintains the mapping result between the zero and non-zero values ​​of the count class status bit. When the count value of the count class status bit changes, the threshold mapping is re-executed and the value of the corresponding Boolean network node is updated.

[0011] Furthermore, in step S2, the state space of the metadata Boolean network is compressed using a binary decision graph. All states are enumerated through the binary decision graph, and attractors and attraction domains are calculated from all states. The nodes of the binary decision graph correspond to the value branches of the Boolean network nodes, and the paths of the binary decision graph correspond to the states of the metadata Boolean network.

[0012] Furthermore, in step S3, when a file operation request is received, the file operation request is encoded as an external input vector. The file operation request includes file open operation, file close operation, file read operation, file write operation, file lock operation, file unlock operation, and file delete operation. The external input vector is input into the metadata Boolean network to perform an update. If the updated state is within the valid state space, the file operation request is submitted and the state vector change is broadcast. If the updated state is outside the valid state space, the file operation request is rejected.

[0013] Furthermore, in step S4, for cases where there are file lock dependencies in the distributed lock operation, the metadata Boolean networks corresponding to the files with file lock dependencies are combined into a product Boolean network. Limit cycles are detected in the state space of the product Boolean network. If a bidirectional waiting mode exists in the limit cycle, it is determined to be a deadlock. The bidirectional waiting mode is that the locking state of the first file depends on the release of the write permission of the second file, and the locking state of the second file depends on the release of the write permission of the first file. The operation initiator with the lowest operation priority is selected to release the lock.

[0014] Furthermore, in step S4.4, when the abnormal state is caused by an incomplete operation, a compensation operation is performed according to the operation log. The compensation operation includes rolling back uncommitted transactions and releasing locks that were not properly released. After the compensation operation is completed, the Boolean network node value flipping continues. After the flipping is completed, the state is input into the metadata Boolean network to perform a one-step asynchronous update to verify whether the state has entered the attraction domain.

[0015] The beneficial effects of this invention are: (1) By mapping file metadata state bits to Boolean network nodes and constructing a metadata Boolean network, the legal state space is characterized by attractors and attraction domains, so that the legality judgment of metadata state has a formal basis and provides a clear judgment standard for distributed consistency maintenance. (2) After the state vector is exchanged and merged among distributed nodes, it is input into the metadata boolean network for updating. Combined with the valid state space check, it can identify the situation of inconsistent metadata states in a timely manner during the state synchronization process. (3) By selecting the target state for recovery through Hamming distance and flipping the values ​​of Boolean network nodes according to the order of update function constraints, the abnormal state is guided to the attraction domain to achieve automatic recovery, thereby reducing the probability of file operation abnormalities caused by metadata inconsistency. Attached Figure Description

[0016] Figure 1 A flowchart illustrating the steps of a distributed file system consistency method based on Boolean networks; Figure 2 A flowchart illustrating the specific steps of a Boolean network-based distributed file system consistency method provided in this embodiment. Figure 3 Boolean network state space partitioning and abnormal state recovery path diagram provided for the embodiment; Figure 4 The diagram illustrates the Boolean network node value reversal process provided in this embodiment. Detailed Implementation

[0017] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0018] Example 1 See Figure 1 This paper presents a distributed file system consistency method based on Boolean networks, which includes the following steps: S1. Extract the status bits from the file metadata in the distributed file system, map the status bits contained in the file metadata to Boolean network nodes, and each Boolean network node takes a Boolean value to obtain the metadata Boolean network. S2. Define an update function for each Boolean network node in the metadata Boolean network. The update function takes the current state of all Boolean network nodes and the external input vector as independent variables. Evolve the metadata Boolean network through the update function, calculate the attractors and attraction domains of the metadata Boolean network, and obtain the legal state space. S3. Encode the metadata Boolean network state into a state vector, exchange the state vectors between distributed file system nodes, merge the exchanged state vectors, input the merged state into the metadata Boolean network to perform an update to obtain the updated state, and check whether the updated state is within the valid state space. S4. Perform an attraction domain check on the updated state, mark states outside the attraction domain as abnormal states, perform a recovery operation on abnormal states, and restore the abnormal states to the attractor.

[0019] In some specific implementation processes, in step S1, the extraction of state bits and the mapping of Boolean network nodes adopt a state bit dependency graph construction method, including the following steps: S1.01. Extract the dependencies between state bits from the file metadata operation rules. The dependencies include direct dependencies and indirect dependencies. Direct dependencies are when a change in the value of one state bit directly triggers a change in the value of another state bit. Indirect dependencies are when a change in the value of one state bit triggers a change in the value of another state bit through an intermediate state bit. Combine all dependencies into a state bit dependency graph. S1.02. Map each state bit in the state bit dependency graph to a Boolean network node, and map each dependency relationship in the state bit dependency graph to a connection edge between Boolean network nodes. The direction of the connection edge is consistent with the triggering direction of the dependency relationship. The connection edge is used to identify the update triggering relationship between Boolean network nodes. S1.03. Combine all Boolean network nodes and connecting edges into a metadata Boolean network according to the topology of the state bit dependency graph. The update order of Boolean network nodes in the metadata Boolean network is determined by the direction of the connecting edges.

[0020] In practical implementation, the extraction of state bits and mapping of Boolean network nodes in step S1 includes the following sub-steps: S1.1. Extract status bits from file metadata. Status bits include file locked status, write permission held status, read permission held status, open handle valid status, directory entry valid status, transaction in progress status, data block verification valid status, and metadata version synchronization status. S1.2. Map each state bit to a Boolean network node. The Boolean network node takes the value of a first Boolean value or a second Boolean value. The first Boolean value corresponds to the active state of the state bit, and the second Boolean value corresponds to the inactive state of the state bit. S1.3. Perform threshold mapping on the Boolean network nodes corresponding to the counting status bits. The counting status bits include the open handle count and the number of readers. Compare the count value of the counting status bits with the set value. When the count value is greater than the set value, map the value of the Boolean network node corresponding to the counting status bit to the first Boolean value. When the count value is equal to the set value, map the value of the Boolean network node corresponding to the counting status bit to the second Boolean value. S1.4. Combine all Boolean network nodes that have undergone threshold mapping into a metadata Boolean network according to their file metadata affiliation.

[0021] In some specific implementation processes, in step S1.3, the count value of the counting status bit is divided into a first count value interval and a second count value interval. The count value in the first count value interval is less than or equal to a set value, and the count value in the second count value interval is greater than the set value. When the count value is in the first count value interval, the value of the Boolean network node corresponding to the counting status bit is mapped to the second Boolean value. When the count value is in the second count value interval, the value of the Boolean network node corresponding to the counting status bit is mapped to the first Boolean value. When the count value switches between the first count value interval and the second count value interval, the value update of the corresponding Boolean network node is triggered.

[0022] In specific implementation, the update function definition and attractor calculation in step S2 include the following sub-steps: S2.1. Define an update function for each Boolean network node. The update function takes the current state of all Boolean network nodes and the external input vector as independent variables. The update function outputs the Boolean value of the corresponding Boolean network node at the next time step. The update function is derived from the constraint rules of file metadata state transition. The update function is represented in disjunctive normal form. S2.2. An asynchronous update mode is adopted to evolve the metadata Boolean network through an update function. Each Boolean network node triggers an update based on its own state change, without using a global clock for synchronous updates. S2.3. Starting from each initial state of the metadata Boolean network, iterate and evolve in an asynchronous update mode until entering a loop, recording all attractors. Attractors include single-point attractors and limit cycles. Single-point attractors correspond to the stable no-operation state of the file metadata, and limit cycles correspond to the periodic operation state of the file metadata. S2.4. Calculate the attraction domain for each attractor. The attraction domain is the set of initial states that eventually enter the corresponding attractor after evolution. The states inside the attraction domain are legal transition states, and the states outside the attraction domain are abnormal states.

[0023] In some specific implementations, step S2.3 involves using a symbolic reachability analysis method for attractor calculation, including the following steps: S2.01. Represent all initial states of the metadata Boolean network as a symbolic state set, and describe the range of states that satisfy the conditions through Boolean expressions; S2.02. Starting from the set of symbolized states, calculate the next reachable set of symbolized states through the update function, merge the next reachable set of symbolized states with the set of visited symbolized states, and use the merged result as the new set of visited symbolized states; S2.03. Repeatedly compute the set of symbolized states that can be reached in the next step and merge them into the set of visited symbolized states until the set of visited symbolized states no longer changes. When the set of visited symbolized states no longer changes, extract the set of cyclic states from the set of visited symbolized states. The set of cyclic states is the attractor.

[0024] In practical implementation, the state vector exchange and merging in step S3 includes the following sub-steps: S3.1. Encode the metadata Boolean network state into a state vector, where each bit of the state vector corresponds to the value of a Boolean network node, and append a version number and node identifier to the state vector; S3.2. Exchange state vectors periodically between nodes of the distributed file system via the gossip protocol, with the exchange period being a set value; S3.3. Compare the version numbers of the received state vector and the local state vector, and take the state vector with the larger version number as the base state vector; S3.4. When the received state vector has the same version number as the local state vector, perform a logical OR operation on the received state vector and the local state vector according to the state bits, and use the result of the logical OR operation as the value of the corresponding state bit in the merged state; when the received state vector has a different version number from the local state vector, use the base state vector as the merged state. S3.5. Input the merged state into the metadata boolean network and perform an asynchronous update to obtain the updated state. Check whether the updated state is within the valid state space. If it is within the valid state space, update the local state and increment the version number. If it is outside the valid state space, trigger the abnormal state recovery process.

[0025] In some specific implementation processes, in step S3.4, the received state vector is compared bit by bit with the local state vector. State bits with the same value are directly used as the value of the corresponding state bit in the merged state. State bits with different values ​​are arbitrated according to the priority of the state bits. The priority of the state bits is determined by the metadata function category to which the state bits belong. The value of the state bit with higher priority is used as the arbitration result. The arbitration result is used as the value of the corresponding state bit in the merged state. After all state bits are arbitrated, the merged state is obtained.

[0026] In practical implementation, the abnormal state detection and recovery in step S4 includes the following sub-steps: S4.1. After each metadata Boolean network state update or state vector merging, check whether the current state is within the attraction domain of any attractor; S4.2. Mark states outside the attraction domain as abnormal states, record the abnormal state vector and triggering operation. Abnormal states include locked but no writer state, deleted file still has open handle state, and transaction state but version is outdated. S4.3. Calculate the Hamming distance from the abnormal state to all attractors, and select the attractor with the smallest Hamming distance as the target state to be recovered; S4.4. Determine the set of Boolean network nodes that need to be flipped between the abnormal state and the recovery target state. Flip the Boolean network node values ​​in the order of the update function constraints. After each flip, check whether the state has entered the attraction domain. S4.5. After the Boolean network node completes the value flip and the state enters the attraction domain, it broadcasts the restored state vector to notify other nodes in the distributed file system to synchronize the state.

[0027] In specific implementation, in step S1, the count value of the count class status bit is maintained locally. The precise value of the count value is maintained locally by the distributed file system node. The metadata Boolean network only maintains the mapping result of zero and non-zero values ​​of the count class status bit. When the count value of the count class status bit changes, the threshold mapping is re-executed and the value of the corresponding Boolean network node is updated.

[0028] In some specific implementation processes, in step S1, the file metadata is changed and the status bits corresponding to the changed file metadata are marked as changed status bits. Only the changed status bits are extracted and mapped to Boolean network nodes. The status bits that have not changed use the existing Boolean network node values. After the changed status bit mapping is completed, the values ​​of the corresponding Boolean network nodes in the metadata Boolean network are updated.

[0029] In specific implementation, in step S2, the state space of the metadata Boolean network is compressed using a binary decision graph. All states are enumerated through the binary decision graph, and attractors and attraction domains are calculated from all states. The nodes of the binary decision graph correspond to the value branches of the Boolean network nodes, and the paths of the binary decision graph correspond to the states of the metadata Boolean network.

[0030] In specific implementation, in step S3, when a file operation request is received, the file operation request is encoded as an external input vector. The file operation request includes file open operation, file close operation, file read operation, file write operation, file lock operation, file unlock operation, and file delete operation. The external input vector is input into the metadata Boolean network to perform an update. If the updated state is within the valid state space, the file operation request is submitted and the state vector change is broadcast. If the updated state is outside the valid state space, the file operation request is rejected.

[0031] In some specific implementations, step S3, the file operation request processing adopts an operation sequence pre-verification method, including the following steps: S3.01. Arrange the file operation requests received within the set time window into an operation sequence according to the order of receipt time, and encode the operation sequence into an external input vector sequence; S3.02. Input the external input vectors into the metadata Boolean network in the order of the external input vector sequence to perform pre-update. After each pre-update step, check whether the pre-update state is in the valid state space and record the check results of all pre-update states. S3.03. When all pre-updated states are within the valid state space, submit all file operation requests in the operation sequence and broadcast the state vector change. If there is a file operation request in the operation sequence that causes the pre-updated state to be outside the valid state space, reject it.

[0032] In specific implementation, in step S4, for cases where there is inter-file lock dependency in the distributed lock operation, the metadata Boolean networks corresponding to the files with inter-file lock dependency are combined into a product Boolean network. Limit cycles are detected in the state space of the product Boolean network. If a bidirectional waiting mode exists in the limit cycle, it is determined to be a deadlock. The bidirectional waiting mode is that the locking state of the first file depends on the release of the write permission of the second file, and the locking state of the second file depends on the release of the write permission of the first file. The operation initiator with the lowest operation priority is selected to release the lock.

[0033] In specific implementation, in step S4.4, when the abnormal state is caused by an incomplete operation, a compensation operation is performed according to the operation log. The compensation operation includes rolling back uncommitted transactions and releasing locks that were not properly released. After the compensation operation is completed, the Boolean network node value flipping continues. After the flipping is completed, the state is input into the metadata Boolean network to perform a one-step asynchronous update to verify whether the state has entered the attraction domain.

[0034] Example 2 This embodiment provides a specific implementation process for a distributed file system consistency method based on Boolean networks. It maps file metadata states in the distributed file system to Boolean network nodes, utilizes the attractors and attraction fields of the Boolean network to describe the valid state space of file metadata, achieves metadata state synchronization between distributed nodes through state vector exchange and merging, and performs recovery processing on abnormal states that deviate from the valid state space, thereby ensuring the consistency of metadata states in the distributed file system. Figure 2 As shown, the specific implementation process is as follows: Step 1. Metadata status bit extraction and network construction: Step 1.1. Status bit extraction: The status bits are extracted from the file metadata. These status bits are Boolean flags representing the current operation and permission status of the file. They include file lock status, write permission held status, read permission held status, open handle valid status, directory entry valid status, transaction in progress status, data block verification valid status, and metadata version synchronization status. The file lock status indicates whether the file is locked; the write permission held status indicates whether an operation initiating with write permission exists; the read permission held status indicates whether an operation initiating with read permission exists; the open handle valid status indicates whether a valid file open handle exists; the directory entry valid status indicates whether the directory entry corresponding to the file is valid; the transaction in progress status indicates whether there are any incomplete file operation transactions; the data block verification valid status indicates whether the verification information of the file data blocks is valid; and the metadata version synchronization status indicates whether the file metadata version is synchronized with other nodes in the distributed file system. After the status bits are extracted, all status bits are grouped according to their association with the file metadata, with status bits corresponding to the same file metadata grouped together.

[0035] Step 1.2. Status bit mapping: Each state bit is mapped to a Boolean network node. A Boolean network is a discrete dynamic system composed of Boolean variable nodes and logical connections between them. Each node in the Boolean network takes the value of a Boolean quantity, which evolves over time according to an update function. A Boolean network node takes either a first Boolean value or a second Boolean value. The first Boolean value corresponds to the active state of the state bit, and the second Boolean value corresponds to the inactive state. The first Boolean value indicates that the state identified by the state bit is in effect, and the second Boolean value indicates that the state identified by the state bit is inactive. There is a one-to-one correspondence between state bits and Boolean network nodes; each state bit corresponds to a unique Boolean network node, and each Boolean network node corresponds to a unique state bit.

[0036] Step 1.3. Threshold mapping for counting state bits: Threshold mapping is applied to the Boolean network nodes corresponding to the counting status bits. The counting status bits are status bits that take count values ​​rather than Boolean values. These include the open handle count and the number of readers. The open handle count represents the number of currently valid open file handles, and the number of readers represents the number of operators currently holding read permissions. The count value of the counting status bits is compared with a preset value. If the count value is greater than the preset value, the Boolean network node value corresponding to the counting status bit is mapped to the first Boolean value; if the count value is equal to the preset value, the Boolean network node value is mapped to the second Boolean value. The preset value is a pre-defined threshold used to distinguish between zero and non-zero values ​​in the counting status bits. A preset value of zero indicates a zero count value mapped to the second Boolean value, and a non-zero count value mapped to the first Boolean value. The count values ​​of counting state bits are maintained locally. The precise values ​​of the count values ​​are maintained locally by the distributed file system nodes. The metadata Boolean network only maintains the mapping results between zero and non-zero values ​​of the counting state bits. When the count value of a counting state bit changes, the threshold mapping is re-executed and the value of the corresponding Boolean network node is updated. The precise values ​​of the count values ​​are only stored on the local node and are not propagated between distributed file system nodes through the state vector. Threshold mapping allows counting state bits to be incorporated into the Boolean network in the form of Boolean quantities for unified evolution processing.

[0037] Step 1.4. Network Combination: All Boolean network nodes that have undergone threshold mapping are grouped into a metadata Boolean network according to their affiliation with file metadata. The metadata Boolean network is a Boolean network whose node set is the Boolean network node corresponding to the file metadata state bits. It is used to describe the logical relationships and dynamic evolution patterns between file metadata states. Boolean network nodes corresponding to the same file metadata are grouped into the same node group, and node groups corresponding to different file metadata are connected through file operation associations. Once the metadata Boolean network is constructed, it serves as the basis for subsequent update function definitions and state space calculations.

[0038] Table 1. Metadata Status Bits and Boolean Network Node Mapping Table In some specific implementations, the mapping relationship between metadata status bits and Boolean network nodes is shown in Table 1. Status bit number 1 corresponds to Boolean network node number 1, with the first Boolean value indicating file lock status is active and the second Boolean value indicating file lock status is inactive, and the number of associated nodes is 3; Status bit number 2 corresponds to Boolean network node number 2, with the first Boolean value indicating write permission holding status is active and the second Boolean value indicating write permission holding status is inactive, and the number of associated nodes is 2; Status bit number 3 corresponds to Boolean network node number 3, with the first Boolean value indicating read permission holding status is active and the second Boolean value indicating read permission holding status is inactive, and the number of associated nodes is 2; Status bit number 4 corresponds to Boolean network node number 4, with the first Boolean value indicating open handle valid status is active and the second Boolean value indicating open handle valid status is active. The first node is inactive, with 4 associated nodes. The second node, corresponding to Boolean network node number 5, has two associated nodes: a first Boolean value indicating the directory entry is active and a second Boolean value indicating it is inactive. The third node, corresponding to Boolean network node number 6, has five associated nodes: a first Boolean value indicating the transaction is in progress and a second Boolean value indicating it is inactive. The fourth node, corresponding to Boolean network node number 7, has two associated nodes: a first Boolean value indicating the data block verification is active and a second Boolean value indicating it is inactive. The fifth node, corresponding to Boolean network node number 8, has three associated nodes: a first Boolean value indicating the metadata version synchronization is active and a second Boolean value indicating it is inactive. Once the mapping relationship is determined, changes in the status bit values ​​directly reflect changes in the corresponding Boolean network node values. These changes trigger updates to the associated Boolean network node values ​​via update functions, thus achieving the dynamic evolution of the file metadata status within the metadata Boolean network. The number of associated nodes determines the range of associated nodes that need to be checked synchronously when the value of a Boolean network node changes. The number of associated nodes for the Boolean network node corresponding to the "Transaction in Progress" state is 5, and the update function trigger conditions of 5 associated nodes need to be checked when the value changes. The number of associated nodes for the "Write Permission Holding" state, "Read Permission Holding" state, "Directory Entry Valid" state, and "Data Block Verification Valid" state is 2, and the update function trigger conditions of 2 associated nodes need to be checked when the value changes. The Boolean network node sequence number maintains the same order as the state bit sequence number. During state vector encoding, the bits of the state vector are arranged in ascending order of the Boolean network node sequence number, ensuring a one-to-one correspondence between the position of each bit in the state vector and the Boolean network node sequence number. This facilitates locating the Boolean network node corresponding to each state bit during state vector decoding.The number of associated nodes is also used to determine the impact range of Boolean network node value reversal during abnormal state recovery. The number of associated nodes corresponding to the valid state of the open handle is 4. After the value is reversed, it is necessary to check whether the state of the 4 associated nodes is still within the valid state space to ensure that the recovery process does not introduce new abnormal states.

[0039] In some embodiments, the status bit extraction adopts an incremental extraction method, which detects changes in file metadata, marks the status bits corresponding to the changed file metadata as changed status bits, performs status bit extraction and Boolean network node mapping only on the changed status bits, and uses the existing Boolean network node values ​​for the unchanged status bits. After the changed status bit mapping is completed, the values ​​of the corresponding Boolean network nodes in the metadata Boolean network are updated.

[0040] In some embodiments, state bit extraction and Boolean network node mapping adopt a state bit dependency graph construction method. The dependency relationships between state bits are extracted from the file metadata operation rules. The dependency relationships include direct dependency relationships and indirect dependency relationships. The direct dependency relationship is that the value change of one state bit directly triggers the value change of another state bit. The indirect dependency relationship is that the value change of one state bit triggers the value change of another state bit through an intermediate state bit. All dependency relationships are combined into a state bit dependency graph. Each state bit in the state bit dependency graph is mapped to a Boolean network node. Each dependency relationship in the state bit dependency graph is mapped to a connection edge between Boolean network nodes. The direction of the connection edge is consistent with the triggering direction of the dependency relationship. All Boolean network nodes and connection edges are combined into a metadata Boolean network according to the topology of the state bit dependency graph.

[0041] Step 2. Update function definition and state space calculation: Step 2.1. Update the function definition: An update function is defined for each Boolean network node. The update function takes the current state of all Boolean network nodes and the external input vector as its independent variables, and outputs the Boolean value of the corresponding Boolean network node at the next time step. The update function is derived from the constraint rules of file metadata state transitions. These constraints describe how the file metadata state changes under file operations, and are derived from the file system's metadata management specifications and operational semantics. The update function is represented in disjunctive normal form (DNF), a standard form of Boolean logic expression composed of several conjunction clauses connected by logical OR. DNF facilitates subsequent symbolic computation and state space enumeration. The external input vector is a Boolean vector representing external file operation requests. Each element of the external input vector corresponds to whether a file operation request is in a pending state.

[0042] Step 2.2. Asynchronous Update Evolution: An asynchronous update mode is adopted to evolve the metadata Boolean network through update functions. Each Boolean network node triggers an update based on its own state changes, without using a global clock for synchronization. Asynchronous update mode is an update scheduling method for Boolean networks. In this mode, the update times of each node are independent; a node executes an update when its own state meets the update triggering conditions, without waiting for a global clock signal. Asynchronous update mode can reflect the asynchronous characteristics of the state changes of each node in a distributed file system, avoiding the coordination overhead of global clock synchronization.

[0043] Step 2.3. Attractor Calculation: Starting from each initial state of the metadata Boolean network, iterates and evolves in an asynchronous update mode until a loop is entered, recording all attractors. An attractor is the set of loop states that the Boolean network eventually enters during its evolution. Attractors include single-point attractors and limit cycles. A single-point attractor contains only one state, corresponding to the stable and invariant state of the Boolean network evolution. A limit cycle contains multiple states and cyclically repeats between these states. A single-point attractor corresponds to the stable, operation-free state of the file metadata, while a limit cycle corresponds to the periodic operation state of the file metadata. After the attractor calculation is completed, all stable and periodic states of the metadata Boolean network are obtained.

[0044] In some embodiments, the attractor computation employs a symbolic reachability analysis approach, representing all initial states of the metadata Boolean network as a symbolic state set. The symbolic state set describes the range of states that satisfy the conditions through Boolean expressions. Starting from the symbolic state set, the next reachable symbolic state set is calculated through an update function. The next reachable symbolic state set is merged with the visited symbolic state set, and the computation is repeated until the visited symbolic state set no longer changes. The cyclic state set is extracted from the visited symbolic state set as the attractor.

[0045] Step 2.4. Calculation of the attraction field: For each attractor, an attraction domain is calculated. An attraction domain is the set of initial states that eventually enter the corresponding attractor after evolution. States within an attraction domain are valid transition states, meaning states that can eventually enter the attractor during evolution. Valid transition states indicate that the file metadata is in a normal operational transition process. States outside an attraction domain are anomalous states, meaning states that cannot enter any attractor through normal evolution. Anomalous states indicate that the file metadata is in an inconsistent or illegal state. After the attraction domains are calculated, all attractors and their corresponding attraction domains form a valid state space. The valid state space represents the range of states that the file metadata is allowed to be in, and it serves as the basis for subsequent state checks and anomaly recovery decisions.

[0046] The state space of the metadata Boolean network is compressed using a binary decision graph. A binary decision graph is a directed acyclic graph data structure used to represent Boolean functions. It achieves a compact representation of Boolean functions by sharing equivalence subgraphs. All states are enumerated using the binary decision graph, and attractors and attraction domains are calculated from all states. Nodes in the binary decision graph correspond to value branches of nodes in the Boolean network, and paths in the binary decision graph correspond to states in the metadata Boolean network. This compressed representation of the binary decision graph reduces the storage space required for state space storage and improves the execution efficiency of attractor and attraction domain calculations.

[0047] Step 3. State vector swapping and merging update: Step 3.1. State Vector Encoding: The metadata Boolean network state is encoded into a state vector, where each bit of the state vector corresponds to the value of a Boolean network node. The state vector is appended with a version number and a node identifier. The state vector is a vector data structure used for transmitting the metadata Boolean network state between distributed file system nodes. The bit order of the state vector corresponds one-to-one with the arrangement order of the Boolean network nodes. The version number indicates the number of times the state vector has been updated, incrementing with each local state update. The node identifier is a unique identifier representing the node from which the state vector originated. After the state vector encoding is completed, it is used for exchanging state information between distributed file system nodes.

[0048] Step 3.2. State Vector Swap: The gossip protocol is used to periodically exchange state vectors among nodes in a distributed file system, with an exchange period of a set value. Gossip is a communication protocol used for information propagation between nodes in a distributed system. In gossip, each node periodically and randomly selects other nodes and exchanges the information it holds. This information propagates through the nodes and eventually spreads throughout the entire distributed system. State vector exchange enables each node in the distributed file system to obtain metadata state information from other nodes, providing a data foundation for subsequent state merging and consistency maintenance.

[0049] Step 3.3. State Vector Comparison: The received state vector is compared with the local state vector in terms of version number, and the state vector with the larger version number is selected as the base state vector. The base state vector is the state vector with the newer version number, indicating that the metadata status of the corresponding node is updated more promptly. Version number comparison can quickly determine the relationship between the old and new states of two state vectors, providing a selection criterion for state merging.

[0050] Step 3.4. State Vector Merging: When the received state vector has the same version number as the local state vector, a logical OR operation is performed on the received state vector and the local state vector according to their state bits. The result of the logical OR operation is used as the value of the corresponding state bit in the merged state. When the received state vector has a different version number than the local state vector, the base state vector is used as the merged state. The logical OR operation is a type of Boolean logic operation. The result of the logical OR operation is a first Boolean value if and only if at least one of the two operands is a first Boolean value. When the version numbers are the same, it means that the two state vectors correspond to concurrent updates based on the same version. The state bit values ​​in the two state vectors are merged by the logical OR operation. When the version numbers are different, the base state vector with the newer version number is directly used as the merged result.

[0051] In some embodiments, state vector merging adopts a bit-by-bit arbitration method. The received state vector is compared bit by bit with the local state vector. State bits with the same value are directly used as the value of the corresponding state bit in the merged state. State bits with different values ​​are arbitrated according to the priority of the state bits. The priority of the state bits is determined by the metadata function category to which the state bits belong. The value of the state bit with higher priority is used as the arbitration result. The arbitration result is used as the value of the corresponding state bit in the merged state. After all state bits have been arbitrated, the merged state is obtained.

[0052] Step 3.5. Post-merge status update and check: The merged state is input into the metadata boolean network to perform a one-step asynchronous update to obtain the updated state. The updated state is checked to see if it falls within the valid state space. If it does, the local state is updated and the version number is incremented; otherwise, an abnormal state recovery process is triggered. A one-step asynchronous update involves performing a node update operation according to the asynchronous update mode. The updated state is the state of the metadata boolean network after the one-step asynchronous update. The valid state space check ensures that the merged metadata state is within the allowed state range of the file metadata. If the check passes, the merge result is accepted and the local state is updated; if the check fails, an abnormal state recovery process is triggered to handle the abnormal state.

[0053] Upon receiving a file operation request, it is encoded as an external input vector. File operation requests include file open, file close, file read, file write, file lock, file unlock, and file delete operations. This external input vector is input into the metadata Boolean network for update. If the updated state is within the valid state space, the file operation request is submitted and the state vector change is broadcast. If the updated state is outside the valid state space, the file operation request is rejected. Encoding file operation requests as external input vectors allows file operations to drive the evolution of the metadata Boolean network as external inputs. Whether a file operation request is allowed to execute is determined by whether the updated state is within the valid state space, thus performing a validity check before file operation execution.

[0054] In some embodiments, file operation request processing employs an operation sequence pre-verification method. File operation requests received within a set time window are arranged into an operation sequence according to their receipt time. The operation sequence is encoded into an external input vector sequence. The external input vectors are sequentially input into the metadata Boolean network in the order of the external input vector sequence to perform pre-update. After each pre-update step, it is checked whether the pre-updated state is within the valid state space. When all pre-updated states are within the valid state space, all file operation requests in the operation sequence are submitted and the state vector change is broadcast. If there is a pre-updated state outside the valid state space, the file operation request in the operation sequence that causes the pre-updated state to be outside the valid state space is rejected.

[0055] Step 4. Abnormal State Detection and Recovery Processing: Step 4.1. Attraction Domain Check: After each metadata Boolean network state update or state vector merging, it is checked whether the current state is within the attraction domain of any attractor. The attraction domain check is the operation to determine whether the current metadata Boolean network state belongs to the valid state space. This check is implemented by traversing the attraction domains of all attractors and determining whether the current state belongs to any of them. The attraction domain check can promptly detect situations where the metadata state deviates from the valid state space, providing triggering conditions for abnormal state marking and recovery.

[0056] Step 4.2. Abnormal Status Marking: States outside the attraction domain are marked as anomalous states. Annomalous state vectors and triggering operations are recorded. Anomalous states include the "locked but no writer" state, the "deleted file still has open handles" state, and the "transaction in progress but version lagging" state. The "locked but no writer" state refers to a file being locked but without an operator holding write permissions. The "deleted file still has open handles" state refers to a file being deleted but still having valid open handles. The "transaction in progress but version lagging" state refers to a file operation transaction in progress but with metadata versions lagging behind other nodes. After marking anomalous states, the anomalous state vectors and triggering operations serve as the basis for subsequent recovery processing.

[0057] Table 2. Comparison of Abnormal Status Types and Recovery Procedures In some specific implementations, the correspondence between abnormal state types and recovery processes is shown in Table 2. Abnormal state number 1 corresponds to a locked but no-writer state, with trigger operation number 1, number of flipped nodes 2, Hamming distance 2, and recovery operation number 1. Abnormal state number 2 corresponds to a deleted file still having an open handle, with trigger operation number 2, number of flipped nodes 3, Hamming distance 3, and recovery operation number 2. Abnormal state number 3 corresponds to a transaction in progress but with a version outdated state, with trigger operation number 3, number of flipped nodes 2, and Hamming distance 2. The recovery operation number is 1; the abnormal state number 4 corresponds to the state where the directory entry is invalid but the handle is valid, the trigger operation number is 4, the number of flipped nodes is 3, the Hamming distance is 3, and the recovery operation number is 2; the abnormal state number 5 corresponds to the state where the data block verification is invalid but the transaction is in progress, the trigger operation number is 5, the number of flipped nodes is 2, the Hamming distance is 2, and the recovery operation number is 1; the abnormal state number 6 corresponds to the state where the metadata version is out of sync but the lock has been released, the trigger operation number is 6, the number of flipped nodes is 1, the Hamming distance is 1, and the recovery operation number is 1. The number of flipped nodes indicates the number of Boolean network nodes that need to be flipped during the abnormal state recovery process. The number of flipped nodes for the states where the deleted file still has an open handle and the state where the directory entry is invalid but the handle is valid is 3, and 3 Boolean network nodes need to be flipped during the recovery process; the number of flipped nodes for the state where the metadata version is out of sync but the lock has been released is 1, and 1 Boolean network node needs to be flipped during the recovery process. The Hamming distance represents the number of bits that differ between corresponding positions in an abnormal state and the target recovery state. For a deleted file still having an open handle or a directory entry being invalid but the handle is valid, the Hamming distance is 3, indicating a 3-bit difference between the abnormal state and the target recovery state. For metadata version inconsistency but the lock being released, the Hamming distance is 1, indicating a 1-bit difference between the abnormal state and the target recovery state. Recovery operation number 1 corresponds to a node value flipping method, and recovery operation number 2 corresponds to a compensation operation combined with the node value flipping method. For recovery operation number 2, where a deleted file still has an open handle or a directory entry is invalid but the handle is valid, a compensation operation must be performed before node value flipping. After an abnormal state is marked, the number of flipped nodes and the Hamming distance are determined according to the abnormal state type. Boolean network node value flipping or compensation operations are performed according to the recovery operation method corresponding to the recovery operation number. During the flipping process, after each flip, it is checked whether the state enters the attraction domain. Once the state enters the attraction domain, the flipping stops and the recovered state vector is broadcast. The number of flipped nodes is used to estimate the number of flipped steps required for the recovery process, the Hamming distance is used to verify the rationality of the choice of the recovery target state, and the recovery operation number is used to guide the selection of the execution flow for the recovery process.

[0058] Step 4.3. Restore target state selection: Calculate the Hamming distance from the anomalous state to all attractors, and select the attractor with the smallest Hamming distance as the recovery target state. The Hamming distance is the number of bits that differ at corresponding positions between two equal-length vectors; it measures the degree of state difference between the anomalous state and the attractor. The attractor with the smallest Hamming distance represents the legally stable state closest to the anomalous state. Selecting the attractor with the smallest Hamming distance as the recovery target state reduces the number of state bits that need to be modified during the recovery process, thus minimizing the impact of the recovery operation on the metadata state.

[0059] In some specific implementations, the state-space structure of the metadata Boolean network and the minimum flip recovery path of the anomalous state are as follows: Figure 3As shown in the figure, the single-point attractor (legal steady state) includes two types of nodes, A1 and A2; the transition state within the attraction domain includes five types of nodes, s1, s2, s3, s4, and s5; the limit cycle (legal periodic state) includes two types of nodes, L1 and L2; and the abnormal state (outside the attraction domain) includes three types of nodes, E1, E2, and E3. The state space is divided into an attraction domain region and an abnormal state region. The attraction domain region includes the legal transition state region and the limit cycle region. The legal transition state region contains single-point attractors and transition states within the attraction domain. The state vector of single-point attractor A1 takes values ​​of 0, 0, 0, 0, 1, 0, 1, 1, corresponding to the idle stable state. The state vector of single-point attractor A2 takes values ​​of 0, 0, 0, 1, 1, 0, 1, 1, corresponding to the open handle stable state. Transition states s1, s2, s3, s4, and s5 within the attraction domain evolve towards single-point attractor A1 or single-point attractor A2 according to the state transition direction defined by the update function. Transition states s1, s2, and s4 within the attraction domain evolve to single-point attractor A1. Transition states s2, s3, s4, and s5 within the attraction domain evolve to single-point attractor A1. Transition state s3 and transition state s5 within the attraction domain evolve into single-point attractor A2; the limit cycle region of the attraction domain contains limit cycles L1 and L2. Limit cycle L1 corresponds to the transaction in progress state, and limit cycle L2 corresponds to the version synchronization state. Limit cycles L1 and L2 evolve cyclically according to the state transition direction defined by the update function, and limit cycles L1 and L2 form a valid periodic state; the abnormal state region is located outside the attraction domain and contains abnormal states E1, E2, and E3. The state vector values ​​of abnormal state E1 are 1, 0, 0, 1, 1, 0, 1, 1, corresponding to the lock-without-writer state. The state vector values ​​of abnormal state E2 are 0, 1, 0, 1, 0, 0, 1, 1, corresponding to the deleted but still-handle state. The state vector values ​​of abnormal state E3 are 0, 1, 0, 1, 1, 1, 0, 0, corresponding to the version lagging state in the transaction. Abnormal states in the anomalous state region cannot enter any attractor through the normal evolution of the metadata Boolean network. Minimum flip recovery is required. Minimum flip recovery guides the anomalous state to a transitional state within the legal transitional state region of the attraction domain by flipping Boolean network nodes whose values ​​differ from the target state. The transitional state within the attraction domain then evolves to the corresponding single-point attractor according to the state transition direction defined by the update function. The partitioning of the state space structure provides a clear formal basis for determining the legality of metadata states: states within the attraction domain region are legal states, and states within the anomalous state region are anomalous states requiring recovery.A single-point attractor corresponds to a stable, operation-free state of file metadata; a limit cycle corresponds to a periodic operational state of file metadata; a transitional state within the attraction domain corresponds to a state where file metadata is in a normal operational transition process; and an abnormal state corresponds to a state where file metadata is in an inconsistent or illegal state. Determining the minimum flip recovery path ensures that the abnormal state recovery process only requires modifying Boolean network nodes whose values ​​differ from the recovery target state, avoiding unnecessary flip operations on Boolean network nodes with consistent values. The recovered transitional state within the attraction domain can automatically enter the single-point attractor through the normal evolution of the metadata Boolean network without additional intervention.

[0060] Step 4.4. Reverse node values: The set of Boolean network nodes that need to be flipped between the abnormal state and the recovery target state is determined. The values ​​of these Boolean network nodes are flipped sequentially according to the order of the update function constraints. After each flip, the state is checked to see if it has entered the attraction domain. Flipping a Boolean network node value involves changing its value from the first Boolean value to the second or vice versa. The order of the update function constraints is determined by the state transition dependencies defined in the update function. Flipping in this order ensures that the state after each flip satisfies the metadata state transition constraints. After each flip, an attraction domain check is performed. When the state enters the attraction domain, it indicates that the recovery process has guided the metadata state to a valid transition state, and subsequent evolution will automatically enter the attractor.

[0061] In some specific implementations, the execution process of reversing the values ​​of Boolean network nodes is as follows: Figure 4As shown, following the order of the update function constraints, the write permission of n2 is first flipped, with the value of n2 write permission flipped from 1 to 0. After flipping, an intermediate state E is obtained. In intermediate state E, the values ​​of n1 lock, n2 write permission, n3 read permission, n4 handle, n5 directory entry, n6 transaction, n7 checksum, and n8 version are all 0. The Hamming distance after flipping the write permission of n2 is 1. It is then checked whether intermediate state E has entered the attraction domain. If intermediate state E has not entered the attraction domain, the handle of n4 is flipped again. The handle values ​​are flipped from 1 to 0. The Hamming distance after the n4 handle flip is 1. After the flip is completed, the recovery target state is obtained. In the recovery target state, n1 lock value is 0, n2 write permission value is 0, n3 read permission value is 0, n4 handle value is 0, n5 directory entry value is 1, n6 transaction value is 0, n7 checksum value is 1, and n8 version value is 1. Check whether the recovery target state has entered the attraction domain. After the recovery target state enters the attraction domain, the flipping stops and the recovered state vector is broadcast. After two Boolean flips, it converges to the idle attractor. The attraction domain check after each flip is used to confirm whether the current state is in a valid transition state. When the state enters the attraction domain, it means that the subsequent metadata Boolean network evolution will automatically enter the attractor, and there is no need to continue the flipping operation, avoiding additional flipping for states that are already in a valid transition state. During the flipping process, flips are performed in the order constrained by the update function to ensure that the state after each flip satisfies the constraints of the file metadata state transition rules. This avoids new abnormal states arising in intermediate states due to improper flipping order. The flipping order is derived from the dependencies between state bits in the update function, with the Boolean network nodes corresponding to dependent state bits performing flips first. After the flip is complete and the state is confirmed to be in the attraction domain, the restored state is encoded into a state vector and appended with an incremented version number. This vector is then broadcast to other nodes in the distributed file system via the gossip protocol. Upon receiving the restored state vector, other nodes update their local metadata Boolean network state and perform an attraction domain check. After confirming that their local state is within the valid state space, state synchronization is completed.

[0062] When an abnormal state is caused by an incomplete operation, a compensation operation is performed according to the operation log. This compensation operation includes rolling back uncommitted transactions and releasing locks that were not properly released. After the compensation operation is completed, the Boolean network node value reversal continues. After the reversal, the state is input into the metadata Boolean network for a one-step asynchronous update to verify whether the state has entered the attraction domain. The operation log records the log data of the file operation execution process, and the compensation operation is used to undo the impact of the incomplete operation on the metadata state. The compensation operation can clear the abnormal state factors left by the incomplete operation, creating conditions for subsequent node value reversal.

[0063] Step 4.5. Status Broadcast Synchronization: After the Boolean network node completes its value flip and its state enters the attraction domain, it broadcasts the recovered state vector to notify other nodes in the distributed file system to synchronize their states. The recovered state vector is the state vector corresponding to the metadata Boolean network state after the abnormal state recovery process is completed. Broadcasting the state vector enables other nodes in the distributed file system to obtain the recovered metadata state and update their local state, thereby achieving consistency of the metadata state of the entire distributed file system after the abnormal state recovery.

[0064] For distributed lock operations involving file-to-file lock dependencies, the metadata Boolean networks corresponding to the files with inter-file lock dependencies are combined into a product Boolean network. Limit cycles are detected in the state space of this product Boolean network. A deadlock is identified when a bidirectional wait pattern exists within the limit cycle. This bidirectional wait pattern occurs when the locking state of the first file depends on the release of write permissions for the second file, and vice versa. The operation with the lowest priority is selected to release the lock. The product Boolean network is obtained by combining the state spaces of multiple Boolean networks using a Cartesian product. It can simultaneously describe the joint evolution of the metadata states of multiple files with dependencies. Deadlock detection is achieved through limit cycle analysis of the product Boolean network. The bidirectional wait pattern within the limit cycle corresponds to a circular wait situation in distributed lock operations. Selecting the operation with the lowest priority to release the lock breaks the circular wait and resolves the deadlock.

[0065] This embodiment maps file metadata state bits in the distributed file system to Boolean network nodes, constructing a metadata Boolean network to describe the logical relationships and dynamic evolution of file metadata states. The attractors and attraction domains of the Boolean network characterize the legal state space of file metadata, providing a clear formal basis for determining the legality of metadata states. Distributed synchronization of metadata states is achieved through the exchange and merging of state vectors among distributed nodes. After merging, the state input to the metadata Boolean network is updated, and its position is checked to ensure it is within the legal state space, enabling timely detection of inconsistencies in metadata states during state synchronization. For abnormal states outside the legal state space, the Hamming distance to the attractor is calculated to select the target state for recovery. The Boolean network node values ​​are flipped according to the order of the update function constraints to guide the abnormal state into the attraction domain, achieving automatic recovery. Counting state bits are incorporated into the Boolean network for unified processing through threshold mapping. Local maintenance of the exact count value reduces the amount of state vector transmission. The compressed representation of the binary decision graph improves the computational efficiency of the state space. File operation requests are encoded as external input vectors to implement legality verification before operation execution. Limit cycle analysis of the product Boolean network supports distributed deadlock detection. The method described in this embodiment can continuously maintain the consistency of metadata state during the operation of the distributed file system, reduce the probability of abnormal file operations caused by metadata inconsistency, and provide stable metadata consistency guarantee for the distributed file system.

[0066] The above description is merely a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the forms disclosed herein and should not be construed as excluding other embodiments. It can be used in various other combinations, modifications, and environments, and can be altered within the scope of the concept described herein through the above teachings or related technologies or knowledge. Modifications and variations made by those skilled in the art that do not depart from the spirit and scope of the present invention should be within the protection scope of the appended claims.

Claims

1. A consensus method for a distributed file system based on Boolean networks, characterized in that, Includes the following steps: S1. Extract the status bits from the file metadata in the distributed file system, map the status bits contained in the file metadata to Boolean network nodes, and each Boolean network node takes a Boolean value to obtain the metadata Boolean network. S2. Define an update function for each Boolean network node in the metadata Boolean network. The update function takes the current state of all Boolean network nodes and the external input vector as independent variables. Evolve the metadata Boolean network through the update function, calculate the attractors and attraction domains of the metadata Boolean network, and obtain the legal state space. S3. Encode the metadata Boolean network state into a state vector, exchange the state vectors between distributed file system nodes, merge the exchanged state vectors, input the merged state into the metadata Boolean network to perform an update to obtain the updated state, and check whether the updated state is within the valid state space. S4. Perform an attraction domain check on the updated state, mark states outside the attraction domain as abnormal states, perform a recovery operation on abnormal states, and restore the abnormal states to the attractor.

2. The method according to claim 1, characterized in that, Step S1, which involves extracting the state bits and mapping them to Boolean network nodes, includes the following sub-steps: S1.

1. Extract status bits from file metadata. Status bits include file locked status, write permission held status, read permission held status, open handle valid status, directory entry valid status, transaction in progress status, data block verification valid status, and metadata version synchronization status. S1.

2. Map each state bit to a Boolean network node. The Boolean network node takes the value of a first Boolean value or a second Boolean value. The first Boolean value corresponds to the active state of the state bit, and the second Boolean value corresponds to the inactive state of the state bit. S1.

3. Perform threshold mapping on the Boolean network nodes corresponding to the counting status bits. The counting status bits include the open handle count and the number of readers. Compare the count value of the counting status bits with the set value. When the count value is greater than the set value, map the value of the Boolean network node corresponding to the counting status bit to the first Boolean value. When the count value is equal to the set value, map the value of the Boolean network node corresponding to the counting status bit to the second Boolean value. S1.

4. Combine all Boolean network nodes that have undergone threshold mapping into a metadata Boolean network according to their file metadata affiliation.

3. The method according to claim 1, characterized in that, Step S2, which defines the update function and calculates the attractor, includes the following sub-steps: S2.

1. Define an update function for each Boolean network node. The update function takes the current state of all Boolean network nodes and the external input vector as independent variables. The update function outputs the Boolean value of the corresponding Boolean network node at the next time step. The update function is derived from the constraint rules of file metadata state transition. The update function is represented in disjunctive normal form. S2.

2. An asynchronous update mode is adopted to evolve the metadata Boolean network through an update function. Each Boolean network node triggers an update based on its own state change, without using a global clock for synchronous updates. S2.

3. Starting from each initial state of the metadata Boolean network, iterate and evolve in an asynchronous update mode until entering a loop, recording all attractors. Attractors include single-point attractors and limit cycles. Single-point attractors correspond to the stable no-operation state of the file metadata, and limit cycles correspond to the periodic operation state of the file metadata. S2.

4. Calculate the attraction domain for each attractor. The attraction domain is the set of initial states that eventually enter the corresponding attractor after evolution. The states inside the attraction domain are legal transition states, and the states outside the attraction domain are abnormal states.

4. The method according to claim 1, characterized in that, The state vector exchange and merging in step S3 includes the following sub-steps: S3.

1. Encode the metadata Boolean network state into a state vector, where each bit of the state vector corresponds to the value of a Boolean network node, and append a version number and node identifier to the state vector; S3.

2. Exchange state vectors periodically between nodes of the distributed file system via the gossip protocol, with the exchange period being a set value; S3.

3. Compare the version numbers of the received state vector with the local state vector, and take the state vector with the larger version number as the base state vector; S3.

4. When the received state vector has the same version number as the local state vector, perform a logical OR operation on the received state vector and the local state vector according to the state bits, and use the result of the logical OR operation as the value of the corresponding state bit in the merged state; when the received state vector has a different version number from the local state vector, use the base state vector as the merged state. S3.

5. Input the merged state into the metadata boolean network and perform an asynchronous update to obtain the updated state. Check whether the updated state is within the valid state space. If it is within the valid state space, update the local state and increment the version number. If it is outside the valid state space, trigger the abnormal state recovery process.

5. The method according to claim 1, characterized in that, The abnormal state detection and recovery in step S4 includes the following sub-steps: S4.

1. After each metadata Boolean network state update or state vector merging, check whether the current state is within the attraction domain of any attractor; S4.

2. Mark states outside the attraction domain as abnormal states, record the abnormal state vector and triggering operation. Abnormal states include locked but no writer state, deleted file still has open handle state, and transaction state but version is outdated. S4.

3. Calculate the Hamming distance from the abnormal state to all attractors, and select the attractor with the smallest Hamming distance as the target state to be recovered; S4.

4. Determine the set of Boolean network nodes that need to be flipped between the abnormal state and the recovery target state. Flip the Boolean network node values ​​in the order of the update function constraints. After each flip, check whether the state has entered the attraction domain. S4.

5. After the Boolean network node completes the value flip and the state enters the attraction domain, it broadcasts the restored state vector to notify other nodes in the distributed file system to synchronize the state.

6. The method according to claim 1, characterized in that, In step S1, the count value of the counting class status bit is maintained locally. The precise value of the count value is maintained locally by the distributed file system node. The metadata Boolean network only maintains the mapping result between the zero and non-zero values ​​of the counting class status bit. When the count value of the counting class status bit changes, the threshold mapping is re-executed and the value of the corresponding Boolean network node is updated.

7. The method according to claim 1, characterized in that, In step S2, the state space of the metadata Boolean network is compressed using a binary decision graph. All states are enumerated through the binary decision graph, and attractors and attraction domains are calculated from all states. The nodes of the binary decision graph correspond to the value branches of the Boolean network nodes, and the paths of the binary decision graph correspond to the states of the metadata Boolean network.

8. The method according to claim 1, characterized in that, In step S3, when a file operation request is received, the file operation request is encoded as an external input vector. The file operation request includes file open operation, file close operation, file read operation, file write operation, file lock operation, file unlock operation, and file delete operation. The external input vector is input into the metadata Boolean network to perform an update. If the updated state is within the valid state space, the file operation request is submitted and the state vector change is broadcast. If the updated state is outside the valid state space, the file operation request is rejected.

9. The method according to claim 1, characterized in that, In step S4, for cases where there are file lock dependencies in the distributed lock operation, the metadata Boolean networks corresponding to the files with file lock dependencies are combined into a product Boolean network. Limit cycles are detected in the state space of the product Boolean network. If a bidirectional waiting mode exists in the limit cycle, it is determined to be a deadlock. The bidirectional waiting mode is that the locking state of the first file depends on the release of the write permission of the second file, and the locking state of the second file depends on the release of the write permission of the first file. The operation initiator with the lowest operation priority is selected to release the lock.

10. The method according to claim 5, characterized in that, In step S4.4, when the abnormal state is caused by an incomplete operation, a compensation operation is performed according to the operation log. The compensation operation includes rolling back uncommitted transactions and releasing locks that were not properly released. After the compensation operation is completed, the Boolean network node value flipping continues. After the flipping is completed, the state is input into the metadata Boolean network to perform a one-step asynchronous update to verify whether the state has entered the attraction domain.