Data processing method, computer equipment and storage medium

By using multiple storage modules and mapping tables in the target tree in the storage layer system, the problem of data query accuracy in distributed data storage scenarios is solved, and efficient data storage and query are achieved.

CN118708591AActive Publication Date: 2024-09-27HANGZHOU QULIAN TECHNOLOGY CO LTD

Patent Information

Application Number
CN202410852801.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2024-09-27
Estimated Expiration
2044-06-27

AI Technical Summary

Technical Problem

The existing multi-version concurrency control algorithm is mainly suitable for single-machine data storage scenarios, and it is difficult to ensure the accuracy of query data in distributed data storage scenarios.

Method used

By introducing multiple storage modules into the storage layer system and maintaining a mapping table between version numbers and storage module identifiers in the target tree, it is ensured that the target version number and corresponding storage module can be accurately obtained during data query, thereby achieving data Accurate inquiry.

Benefits of technology

Improved data storage capacity and flexibility, ensuring the accuracy and efficiency of data query in distributed scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118708591A
    Figure CN118708591A
Patent Text Reader

Abstract

The invention discloses a data processing method, computer equipment and a storage medium, and belongs to the technical field of computers. The method comprises the steps that if a data query request is received, a target version number is obtained, and the data query request carries a target key value; afterwards, a target leaf node indexed by the target key value in the target tree is determined, and the leaf node in the target tree comprises a file identifier, a minimum key value and a maximum key value in all key value pairs in a file identified by the file identifier, and a mapping table; and obtaining a target storage module identifier from a mapping table in the target leaf node according to the target version number. And obtaining a value in a key value pair to which the target key value belongs from a file of which the file identifier in the storage module identified by the target storage module identifier is the file identifier in the target leaf node. According to the method, data query can be accurately realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data processing method, a computer device and a storage medium. Background Art

[0002] The multi-version concurrency control algorithm is a classic concurrency control algorithm in the database field and an important function for implementing transaction concurrency and rollback. Its main idea is to save historical versions of data and implement database concurrency control by managing multiple versions of data rows. In this way, it is possible to determine whether data is displayed by comparing version numbers, and the isolation effect of transactions can be guaranteed without locking when reading data.

[0003] However, the current multi-version concurrency control algorithm only considers the single-machine data storage scenario, and it is often difficult to ensure the accuracy of query data in distributed data storage scenarios. Summary of the invention

[0004] The present application provides a data processing method, a computer device and a storage medium, which can ensure the accuracy of query data. The technical solution is as follows:

[0005] In a first aspect, a data processing method is provided, the method being applied to a storage layer system, the storage layer system comprising a plurality of storage modules, each of the plurality of storage modules being used to store a file, and files can be migrated between the plurality of storage modules, the method comprising:

[0006] If a data query request is received, the target version number is obtained. The data query request carries a target key value. The target version number is the latest system version number when the data query request is received. The update of the system version number is triggered by any one of the file storage operation and the file migration operation.

[0007] Determine a target leaf node indexed by the target key value in a target tree, wherein the leaf node in the target tree includes a file identifier, a minimum key value and a maximum key value in all key-value pairs in the file identified by the file identifier, and a mapping table, wherein the mapping table includes a mapping relationship between a version number and a storage module identifier, and the mapping table is used to indicate the storage module where the file identified by the file identifier is located under each version;

[0008] Acquire a target storage module identifier from a mapping table in the target leaf node according to the target version number;

[0009] From the file whose file identifier in the storage module identified by the target storage module identifier is the file identifier in the target leaf node, obtain the value in the key-value pair to which the target key value belongs.

[0010] In the present application, the storage layer system stores files through multiple storage modules, and the multiple storage modules can migrate files, which can improve the data storage capacity and data storage flexibility. In this case, both the file storage operation and the file migration operation will trigger version updates. For this reason, the embodiment of the present application also stores a mapping table in the leaf node of the target tree. According to the mapping table, the storage module where the file is located under each version can be determined, so that after receiving the data query request, the required value can be obtained from the corresponding storage module, so that the data query can be accurately realized.

[0011] In a second aspect, a data processing device is provided, the device being applied to a storage layer system, the storage layer system comprising a plurality of storage modules, each of the plurality of storage modules being used to store files, and files being able to be migrated between the plurality of storage modules, the device comprising:

[0012] A first acquisition module is used to acquire a target version number if a data query request is received, the data query request carries a target key value, the target version number is the latest system version number when the data query request is received, and the update of the system version number is triggered by any one of a file storage operation and a file migration operation;

[0013] A determination module, used to determine a target leaf node indexed by the target key value in a target tree, wherein the leaf node in the target tree includes a file identifier, a minimum key value and a maximum key value in all key-value pairs in the file identified by the file identifier, and a mapping table, wherein the mapping table includes a mapping relationship between a version number and a storage module identifier, and the mapping table is used to indicate the storage module where the file identified by the file identifier is located under each version;

[0014] A second acquisition module, configured to acquire a target storage module identifier from a mapping table in the target leaf node according to the target version number;

[0015] The third acquisition module is used to obtain the value in the key-value pair to which the target key value belongs from the file whose file identifier in the storage module identified by the target storage module identifier is the file identifier in the target leaf node.

[0016] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the data processing method described in the first aspect when executed by the processor.

[0017] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the data processing method described in the first aspect is implemented.

[0018] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the steps of the data processing method described in the first aspect.

[0019] It can be understood that the beneficial effects of the second, third, fourth and fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0021] Figure 1 is a schematic diagram of a storage layer system provided in an embodiment of the present application;

[0022] Figure 2 is a schematic diagram of a target tree provided in an embodiment of the present application;

[0023] Figure 3 is a schematic diagram of a key-value pair provided in an embodiment of the present application;

[0024] Figure 4 is a schematic diagram of another key-value pair provided in an embodiment of the present application;

[0025] Figure 5 is a schematic diagram of index information provided by an embodiment of the present application;

[0026] Figure 6 is a flow chart of a data processing method provided in an embodiment of the present application;

[0027] Figure 7 is a structural schematic diagram of a data processing device provided in an embodiment of the present application;

[0028] Figure 8 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0029] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.

[0030] The data processing method provided in the embodiment of the present application can be applied to a system with data processing requirements. In the embodiment of the present application, the system is referred to as a storage layer system. The storage layer system is described below.

[0031] The embodiments of the present application are applied to a scenario where an external system performs data query based on a storage layer system. For example, the embodiments of the present application can be applied to a scenario where data query is performed based on a target tree.

[0032] For example, the blockchain system generates a key (i.e., key value) that needs to be queried during the execution of a transaction in a certain block. In this case, the data processing method provided in the embodiment of the present application can be used to query the value corresponding to the key value based on the target tree.

[0033] The external system that the storage layer system is connected to is a system with data query requirements and data storage requirements. For example, the external system that the storage layer system is connected to can be a database system, a blockchain system, etc., which is not limited in the embodiments of the present application.

[0034] The storage layer system is used to receive, process and reply various requests sent by the external system. For example, the request sent by the external system may include a data storage request, a data query request, etc., which is not limited in the embodiments of the present application.

[0035] For example, Figure 1 Schematic diagram of a storage layer system provided by an embodiment of the present application. Figure 1 The storage layer system may include multiple storage modules, such as storage module 1, storage module 2, ..., storage module m.

[0036] Each storage module in the multiple storage modules is used to store files, and files can be migrated between the multiple storage modules.

[0037] The files in the storage module contain data sent by the external system that needs to be stored, such as key-value pairs, etc. For example, the storage module may be a disk or other device that can be used for data storage.

[0038] File migration refers to the storage layer system storing files in one storage module to another storage module. For example, the storage layer system can migrate files in storage module 1 to storage module 2 for storage.

[0039] Optionally, a storage module may correspond to an instance, and the instance may be bound to a path of the corresponding storage module, so that the storage layer system can store data to the corresponding storage module or read data from the corresponding storage module through the instance.

[0040] The storage module has an identifier, namely, a storage module identifier. A storage module identifier is used to identify a storage module.

[0041] In some embodiments, the storage layer system has a version number. One version number corresponds to one version, and one version number corresponds to one version that can represent a file distribution state in the storage layer system, and the file distribution state refers to which files are specifically stored in each storage module.

[0042] For example, storing a new file will trigger a version update, and migrating a file between storage modules will also trigger a version update. Version updates are strictly executed serially within the storage layer system.

[0043] The storage layer system has a system version number, which can be a continuously increasing integer. The system version number is used to indicate the latest version number of the storage layer system. For example, the system version number can be 0, 1, 2, 3, 4, ...

[0044] For example, the update of the system version number may be triggered by any one of a file storage operation and a file migration operation.

[0045] Specifically, when the storage layer system performs a file storage operation or a file migration operation, a new version number is generated. After the storage layer system completes the file storage operation or the file migration operation, the system version number can be updated to the new version number.

[0046] In some embodiments, the storage layer system can be connected to a database system. The database system can be connected to other systems that have data storage requirements, such as a blockchain system. For example, when the blockchain system needs to store data, the data can be sent to the database system first, and then sent to the storage layer system by the database system. The storage layer system can store the data based on the target tree.

[0047] Optionally, the storage layer system and the database system can be independent systems, in which case the storage layer system and the database system can run on independent physical machines respectively. Alternatively, the database system can include the storage layer system, in which case the database system includes a specific system that interfaces with the blockchain system and runs on the same physical machine as the storage layer system.

[0048] Next, the structure of the target tree provided in the embodiment of the present application is described.

[0049] The target tree is a tree structure. The target tree includes branch nodes and leaf nodes at the bottom of the target tree. Among them, a node with 0 child nodes is a leaf node, and a node with 1 child nodes is a branch node. Both branch nodes and leaf nodes are logical nodes. The topmost branch node in the target tree can be called a root node, which is a branch node without a parent node in the target tree.

[0050] Optionally, the target tree may be an n-ary tree, that is, the maximum number of child nodes of each branch node in the target tree is n, where n is an integer greater than or equal to 2. Any branch node in the n-ary tree can have at most n child nodes. Moreover, for branch nodes at the same level in the n-ary tree, a new branch node can be added after the last branch node of this level only when the number of child nodes of the last branch node of this level reaches n.

[0051] The leaf node stores the file identifier, maximum key value, minimum key value and mapping table.

[0052] The file identifier is used to identify the file stored in the storage layer system. For example, the file identifier can be a file identity (ID), a file name, etc., which is not limited in the embodiment of the present application.

[0053] The minimum key value in a leaf node is the minimum key value in the file identified by the file identifier in the leaf node. The maximum key value in a leaf node is the maximum key value in the file identified by the file identifier in the leaf node.

[0054] In the embodiment of the present application, the leaf nodes in the target tree correspond to the files one by one, that is, a leaf node corresponds to a file identifier of a file and the minimum key value and the maximum key value in the file.

[0055] The mapping table in the leaf node is used to indicate the storage module where the file identified by the file identifier in the leaf node is located under each version. The mapping table may include a mapping relationship between a version number and a storage module identifier. A version number and its mapped storage module identifier in the mapping relationship are used to indicate that the file is stored in the storage module identified by the storage module identifier at the version corresponding to the version number.

[0056] In some embodiments, the mapping table can be a doubly linked list, and each node in the doubly linked list includes a version number and a storage module identifier. In this case, the doubly linked list can maintain two node pointers, one of which is a head pointer, used to indicate the head node of the doubly linked list, and the other is a tail pointer, used to indicate the tail node of the doubly linked list.

[0057] In an embodiment of the present application, the storage layer system can store one or more files, and each file can contain one or more key-value pairs. The file identifiers of all files stored in the storage layer system are globally ordered, that is, the file identifier of any file exists in order in all files stored in the storage layer system. Moreover, the key values ​​in all key-value pairs contained in these files are also globally ordered, that is, the key value in any key-value pair contained in any file exists in order in all key-value pairs in all files stored in the storage layer system.

[0058] Optionally, the global ordering of the key values ​​in the key-value pairs may be in increasing lexicographical order.

[0059] In this case, the minimum key value in a file refers to the key value that ranks first among all the key-value pairs in the file. The maximum key value in a file refers to the key value that ranks last among all the key-value pairs in the file.

[0060] It should be noted that in the computer field, lexicographic order can be used to indicate the size relationship between any two strings. The size relationship between the two strings depends on the size relationship of the American Standard Code for Information Interchange (ASCII) codes of the characters from left to right in the string.

[0061] Optionally, the global ordering of the file identifiers of the files may be in increasing lexicographical order.

[0062] For example, the file identifier of a file may start from 0 and increase by a preset value.

[0063] The preset value can be preset. For example, the preset value can be set to 1, 2, 3, etc., which is not limited in the embodiment of the present application.

[0064] In this case, the file identifiers of all files are an arithmetic progression. For example, assuming the preset value is 1, the file identifiers of the first file, the second file, the third file, ..., and the kth file may be generated as 0, 1, 2, ..., k-1, respectively.

[0065] In some embodiments, a global continuously increasing counter may be maintained inside the storage layer system, and the counter is used to generate file identifiers. In this case, each time the storage layer system generates a new file, the current value of the counter may be used as the file identifier of the new file, so that the files stored in the storage layer system are a batch of files whose file identifiers are continuously increasing.

[0066] The branch node includes a child node list, which includes the minimum key value and the maximum key value in each child node of the branch node. For example, the range from the minimum key value in a child node to the maximum key value in the child node can be called the key range of the child node.

[0067] The child nodes of a branch node can be branch nodes or leaf nodes of the next layer. The minimum key value in a branch node is the minimum key value among all key values ​​in the child node list of the branch node, that is, the key value that ranks first among all key values ​​in the child node list; the maximum key value in the branch node is the maximum key value among all key values ​​in the child node list of the branch node, that is, the key value that ranks last among all key values ​​in the child node list. The minimum key value and maximum key value in a leaf node are the minimum key value and maximum key value stored in the leaf node.

[0068] For example, Figure 2 is a schematic diagram of a target tree provided in an embodiment of the present application. Figure 2 , the target tree is a binary tree, and the target tree includes multiple leaf nodes ( Figure 2 Nodes n4, n5, and n6 are taken as examples) and multiple branch nodes ( Figure 2 In the example of node n1, node n2, and node n3, the child nodes of node n1 include node n2 and node n3, the child nodes of node n2 include node n4 and node n5, and the child nodes of node n3 include node n6. In the embodiment of the present application, the topmost branch node in the target tree can be called the root node, for example, Figure 2 The node n1 in is the root node.

[0069] Figure 2 The leaf node n4 in the file stores the file identifier 0, the minimum key value 1, the maximum key value 3, and the mapping table 0. The leaf node n5 stores the file identifier 1, the minimum key value 4, the maximum key value 6, and the mapping table 1. The leaf node n6 stores the file identifier 2, the minimum key value 7, the maximum key value 9, and the mapping table 2.

[0070] Figure 2 The branch node n2 in stores a child node list, which includes the minimum key value 1 and the maximum key value 3 in the leaf node n4, and the minimum key value 4 and the maximum key value 6 in the leaf node n5.

[0071] Figure 2 The branch node n3 in the tree stores a list of child nodes, which includes the minimum key value 7 and the maximum key value 9 in the leaf node n6.

[0072] Figure 2 The branch node n1 in stores a child node list, which includes the minimum key value 1 and the maximum key value 6 in the branch node n2, and the minimum key value 7 and the maximum key value 9 in the branch node n3.

[0073] In the embodiment of the present application, the storage layer system can store the key-value pairs sent by the external system based on the above target tree. For example, the target tree can also be called a solid branch tree (SolidBranchTree).

[0074] In some cases, the key values ​​in the key-value pairs sent by the external system to the storage layer system are globally ordered. The concept of global order has been explained above and will not be repeated here.

[0075] In some embodiments, the storage layer system can be connected to the database system, and the database system can be connected to the blockchain system. In this case, the blockchain system can send key-value pairs to be stored to the database system, and after receiving these key-value pairs, the database system can send a data storage request carrying these key-value pairs to the storage layer system.

[0076] As an example, the key-value pairs to be stored sent by the blockchain system to the database system can be block data. Since block data is strictly organized according to block numbers, that is, the key value in the block data is the block number, the key value in the block data is naturally globally ordered. In this case, the database system can directly carry the block data in the data storage request and send it to the storage layer system for storage.

[0077] As another example, the key-value pairs to be stored sent by the blockchain system to the database system may be the ledger data in a block. The ledger data in a block includes multiple key-value pairs, and the key values ​​in multiple key-value pairs in the same block are different, but the key values ​​in key-value pairs in different blocks may be the same.

[0078] In this case, the database system can first process the ledger data. Specifically, the database system can introduce block numbers into the ledger data to construct key-value pairs with globally ordered key values, and then carry the constructed key-value pairs in the data storage request to the storage layer system for storage. In this way, it can be ensured that the key values ​​in the key-value pairs carried in the data storage request sent by the database system to the storage layer system are all globally ordered.

[0079] Optionally, in an embodiment of the present application, such a key-value pair may be referred to as a target key-value pair, wherein the key value in the target key-value pair includes the block number and the key value in the block identified by the block number (i.e., the key value in the key-value pair in the ledger data), and the value value in the target key-value pair is the value value in the block (i.e., the value value in the key-value pair in the ledger data).

[0080] In some embodiments, the key value in the target key-value pair can be obtained by concatenating the block number and the key value in the block. Of course, the key value in the target key-value pair can also be obtained by other methods, which is not limited to the embodiments of the present application.

[0081] Since block numbers are naturally globally ordered and the key values ​​within a block are different, the key values ​​in the target key-value pair including the block number and the key value within the block identified by the block number are also globally ordered.

[0082] For example, a block with a block number of 00000001 includes multiple key-value pairs. For each of the multiple key-value pairs, the block number 00000001 can be added before the key value in the key-value pair to obtain a new key value.

[0083] For example, Figure 3 As shown in Figure (a), block 1 with block number 00000001 includes key-value pairs bbbb:{value1...}, bggg:{value2...}, caaa:{value3...}, xaab:{value4...}. Figure 3 As shown in Figure (b), block 2 with block number 00000002 includes key-value pairs aabb:{value5...}, bggg:{value6...}, bcde:{value7...}.

[0084] Then, after the blockchain system sends these key-value pairs to the database system, the database system can introduce block number 00000001 into the key-value pairs in block 1, specifically by adding 00000001 to the key value in each key-value pair in block 1, and obtain the target key-value pairs 00000001bbbb:{value1...}, 00000001bggg:{value2...}, 00000001caaa:{value3...}, 00000001xaab:{value4...}. Block number 00000002 is introduced into the key-value pairs in block 2, specifically by adding 00000002 to the key value in each key-value pair in block 2, and obtain the target key-value pairs 00000002aabb:{value5...}, 00000002bggg:{value6...}, 00000002bcde:{value7...}. The key values ​​in the target key-value pairs obtained in this way are globally ordered.

[0085] It should be noted that the storage layer system in the embodiment of the present application is not limited to storing the key-value pairs in the above-mentioned blockchain system, but can also store other key-value pairs as long as the key values ​​in these key-value pairs are globally ordered.

[0086] The following describes the process of constructing the initial target tree by the storage layer system. The process may include the following steps (1) to (5):

[0087] (1) The storage layer system receives a data storage request, which carries a key-value pair to be stored, and the key value in the key-value pair is globally ordered.

[0088] The data storage request is used to instruct the storage layer system to store the key-value pair to be stored. In some embodiments, the data storage request may be sent by an external system. For example, it may be sent by a blockchain system or a database system.

[0089] In this case, the key values ​​in all key-value pairs to be stored sent by the external system to the storage layer system are in order. After the storage layer system stores these key-value pairs, the key values ​​in all key-value pairs stored in the storage layer system are also in order.

[0090] (2) The storage layer system generates a new file containing one or more key-value pairs according to the order of the key values ​​in the key-value pairs, and stores the new file in a first storage module, where the first storage module is one of the multiple storage modules; wherein the file identifiers of all files containing the key-value pairs are globally ordered.

[0091] The first storage module is a storage module for storing new files. For example, the first storage module may be a default storage module among the multiple storage modules, or the first storage module may be a storage module randomly selected from the multiple storage modules, which is not limited in the embodiment of the present application.

[0092] The key values ​​in the key-value pairs to be stored received by the storage layer system are in order. In this case, the storage layer system generates a new file according to the order of the key values ​​in the key-value pairs, and the key values ​​in the key-value pairs in the new file are also in order.

[0093] After the storage layer system stores the new file in the first storage module, it can obtain the identifier of the first storage module.

[0094] In some embodiments, the operation of step (2) may be: each time the storage layer system receives a data storage request, it stores all key-value pairs carried in the data storage request in the memory in the order of the key values ​​in all key-value pairs carried in the data storage request. If the difference between the total amount of data of one or more key-value pairs stored in sequence in the memory and the preset amount of data is less than or equal to the preset difference, the storage layer system generates a new file containing the one or more key-value pairs. The storage layer system stores the new file in the first storage module.

[0095] The preset data volume can be preset. For example, the preset data volume can be set to 8 megabytes (MB), 9 MB, 10 MB, etc., which is not limited in the embodiment of the present application.

[0096] Optionally, the preset data volume can be set according to an integer multiple of the block size configuration of the storage layer system. For example, if the block size is 4MB, the preset data volume can be set to 4MB, 8MB, 12MB, etc. The block size of the storage layer system refers to the smallest unit used by the storage layer system to organize and manage data storage.

[0097] The preset difference value may be preset. For example, the preset difference value may be set to 100 kilobytes (KB), 200 KB, 300 KB, etc., which is not limited in the embodiment of the present application.

[0098] It should be noted that the data volume of each key-value pair is generally close, and the data volume of a key-value pair is usually within a predetermined range. In the embodiment of the present application, the preset data volume can be much larger than the data volume of a key-value pair. The preset difference can be close to the data volume of a key-value pair, such as being equal to or slightly larger than the data volume of a key-value pair.

[0099] The storage layer system can store all key-value pairs carried by each data storage request received in order in the memory. In this case, if the total data volume of all key-value pairs currently stored in order in the memory is close to the preset data volume (that is, the difference between the preset data volume and the preset data volume is less than or equal to the preset difference), then all key-value pairs currently stored in the memory can be stored in the first storage module in the form of new files. In this way, batch storage of key-value pairs can be achieved, thereby improving data storage efficiency. Moreover, in this case, the file size of each file stored in the first storage module is basically the same, and is close to the preset data volume, which facilitates file management.

[0100] It should be noted that if the total data volume of all key-value pairs currently stored in the memory is less than the preset data volume, and the difference between the total data volume and the preset data volume is greater than the preset difference, it means that the total data volume of the key-value pairs currently stored in the memory is significantly different from the preset data volume, and the conditions for generating a new file are not met. In this case, the storage layer system can continue to receive data storage requests sent by the external system, and store the key-value pairs carried by the data storage request in the memory until the difference between the total data volume of multiple key-value pairs stored in sequence in the memory and the preset data volume is less than or equal to the preset difference, and then generate a new file and store it.

[0101] The generated new file is stored in the first storage module, that is, the persistence of the new file is achieved. Moreover, after the new file is stored in the first storage module, one or more key-value pairs in the new file will be deleted from the memory.

[0102] One thing to note is that the key values ​​in the key-value pairs stored in the memory are in order. In this case, if a new file is generated based on the key-value pairs stored in the memory, the key values ​​in all the key-value pairs in the new file are also in order.

[0103] Another point to be explained is that since a file can contain one or more key-value pairs, the key-value pairs in a file can cover the data of one block or multiple blocks.

[0104] For example, Figure 4As shown, the storage layer system receives data storage request 1, which carries key-value pairs 00000001bbbb:{value1...}, 00000001bggg:{value2...}, 00000001caaa:{value3...}, 00000001xaab:{value4...}. The storage layer system saves the key-value pairs carried in data storage request 1 to the memory, and the key-value pairs currently saved in the memory include 00000001bbbb:{value1...}, 00000001bggg:{value2...}, 00000001caaa:{value3...}, 00000001xaab:{value4...}. Since the total data volume of these key-value pairs is less than the preset data volume, and the difference between the data volume and the preset data volume is greater than the preset difference, the condition for generating a new file is not met.

[0105] Afterwards, the storage layer system receives data storage request 2, which carries key-value pairs 00000002aabb:{value5...}, 00000002bggg:{value6...}, and 00000002bcde:{value7...}. The storage layer system stores the key-value pairs carried in data storage request 2 in memory in order. After the storage layer system stores the key-value pairs 00000002bggg:{value6...} in memory, it will be found that the difference between the total amount of data of the key-value pairs 00000001bbbb:{value1...} to 00000002bggg:{value6...} currently stored in the memory and the preset amount of data is less than or equal to the preset difference, which satisfies the condition for generating a new file. Therefore, a new file containing key-value pairs 00000001bbbb:{value1...} to 00000002bggg:{value6...} is generated at this time and stored in the first storage module. In addition, the storage layer system saves the key-value pair 00000002bcde:{value7...} carried in the data storage request 2 in the memory.

[0106] Afterwards, the storage layer system receives data storage request 3, which carries the key-value pair 00000003bcbb:{value1...}. The storage layer system saves the key-value pairs carried in data storage request 3 to the memory in order, so the key-value pairs currently saved in the memory include 00000002bcde:{value7...} and 00000003bcbb:{value1...}. Since the total data volume of these key-value pairs is less than the preset data volume, and the difference between the total data volume and the preset data volume is greater than the preset difference, the new file generation condition is not met. The storage layer system continues to wait for the next data storage request.

[0107] (3) The storage layer system generates an initial version number.

[0108] The initial version number can be preset. For example, the initial version number can be 0.

[0109] Since the storage layer system stores the file for the first time, the storage layer system can generate an initial version number.

[0110] After the storage layer system stores the new file in the first storage module and generates an initial version number, it can determine a mapping relationship between the initial version number and the identifier of the first storage module, which is used to indicate that the new file is stored in the first storage module under the version corresponding to the initial version number.

[0111] (4) The storage layer system generates a new leaf node and constructs an initial target tree based on the new leaf node. The new leaf node contains the file identifier of the new file, the minimum key value and the maximum key value in all key-value pairs in the new file, and a mapping table. The mapping table includes a mapping relationship between the initial version number and the identifier of the first storage module.

[0112] After the storage layer system generates the new leaf node, it can create a new branch node as the parent node of the new leaf node. This branch node stores a list of child nodes, which includes the minimum key value and the maximum key value in the new leaf node. Since the current number of leaf nodes is 1, this branch node is the root node, thus completing the construction of the initial target tree.

[0113] In some embodiments, a branch node in the target tree may include a child node list. The child node list in a branch node stores node information of each child node of the branch node.

[0114] For example, the node information of a node may include a pointer to the node, a minimum key value, and a maximum key value in the node.

[0115] A node pointer is used to point to the memory space where the node is located.

[0116] In this case, the child node list in a branch node includes the node information of all the child nodes of the branch node, and the node information of all the child nodes exists in sequence in the child node list.

[0117] In some cases, after the storage layer system completes the initial construction of the target tree, it can also save the pointer of the root node of the target tree and the pointer of the last leaf node in the target tree in the memory. In this way, the storage layer system can subsequently quickly index to the root node in the target tree according to the pointer of the root node maintained in the memory, and quickly index to the last leaf node in the target tree according to the pointer of the leaf node maintained in the memory.

[0118] (5) The storage layer system creates a system version number and updates the system version number to the initial version number.

[0119] After building the initial target tree, the storage layer system can create a system version number in memory and update the system version number to the initial version number.

[0120] In some embodiments, for any data storage request, if all key-value pairs carried by the data storage request have been stored in the storage module in the form of files, and the target tree has been constructed or updated accordingly, and the system version number has been updated, then the storage layer system can return a data storage success message to the external system that sent the data storage request. For example, the data storage success message can carry the file identifier of the file where the key-value pairs in the data storage request are located, the identifier of the storage module where they are located, etc., which is not limited in the embodiments of the present application.

[0121] In some embodiments, each time the storage layer system updates the system version number, the version information of the version corresponding to the updated system version number can be stored in the disk, and the version information includes the version number and the version increment information, and the version increment information is used to indicate the file changes in the storage module under the version corresponding to the version number compared to the previous version. That is, the version increment information is used to indicate which storage module has reduced which files and which storage module has added which files under this version compared to the previous version. It should be noted that the "files" described in the embodiments of the present application all refer to the files containing key-value pairs involved in the embodiments of the present application.

[0122] It should be noted that the reduction of files in the storage module in the embodiment of the present application is caused by file migration, while the increase of files in the storage module may be caused by file storage or file migration.

[0123] Optionally, the version information may also include the largest file identifier under the version (ie, the file identifier that is ranked last).

[0124] In this case, each time the system version number is updated, the version information of the version corresponding to the updated system version number can be stored in the disk. Then the storage layer system stores the version information of each version in sequence in the disk, that is, one or more version information stored in the disk is ordered.

[0125] In some embodiments, the storage layer system can update the file distribution state stored in the disk according to one or more version information stored in the disk, and the file distribution state includes the corresponding relationship between the version number, the storage module identifier and the file identifier. The file distribution state is used to indicate the files stored in each storage module of the multiple storage modules under the corresponding version. Among them, the file identifier corresponding to any storage module identifier in the corresponding relationship between the storage module identifier and the file identifier is the file identifier of each file stored in all the files in the storage module identified by this storage module identifier.

[0126] Since the one or more version information stored in the disk is ordered, the storage layer system also updates the file distribution status stored in the disk in sequence, that is, updates them in sequence according to the version order.

[0127] When the storage layer system updates the file distribution state stored in the disk according to a certain version information, the version number in the file distribution state can be updated to the version number in the version information, and the corresponding relationship between the storage module identifier and the file identifier in the file distribution state can be updated according to the version increment information in the version information. Then, after the file distribution state is updated according to the version information of a certain version, the updated file distribution state is used to indicate the files stored in each storage module in the multiple storage modules under this version.

[0128] After the storage layer system updates the file distribution status according to a version information, the version information can be deleted from the disk.

[0129] In some cases, the file distribution status can be updated asynchronously by a thread. That is, the storage layer system will record version information every time a version update occurs, so there will be multiple version information after multiple version updates. A thread can update the file distribution status in sequence according to the recorded multiple version information.

[0130] For example, the following Table 1 shows a plurality of version information and a file distribution state after being updated according to each of the plurality of version information in turn.

[0131] Specifically, when the storage layer system stores new file 3 in storage module 1 at the version corresponding to version number 2, the version corresponding to version number 3 is obtained, and the version information of the version is "version number: 3, version increment information: storage module 1 adds file 3". According to the version information, the file distribution status can be updated to "version number: 3, corresponding relationship between storage module identifier and file identifier: storage module 1: {file 2, file 3}, storage module 2: {file 1}".

[0132] Afterwards, at the version corresponding to version number 3, the storage layer system stores new file 4 in storage module 1, and obtains the version corresponding to version number 4. Then the version information of this version is "version number: 4, version increment information: storage module 1 adds file 4". According to this version information, the file distribution status can be updated to "version number: 4, corresponding relationship between storage module identifier and file identifier: storage module 1: {file 2, file 3, file 4}, storage module 2: {file 1}".

[0133] Afterwards, at the version corresponding to version number 4, the storage layer system migrates file 2 from storage module 1 to storage module 2, and obtains a version corresponding to version number 5. Then the version information of this version is "version number: 5, version increment information: storage module 1 reduces file 2, storage module 2 adds file 2". According to this version information, the file distribution status can be updated to "version number: 5, corresponding relationship between storage module identifier and file identifier: storage module 1: {file 3, file 4}, storage module 2: {file 1, file 2}".

[0134] Table 1

[0135]

[0136] The embodiment of the present application only uses Table 1 above as an example to exemplify the version information and file distribution status, and Table 1 above does not constitute a limitation on the embodiment of the present application.

[0137] As an example, the target tree in the embodiment of the present application does not need to be persisted, that is, it does not need to be stored in a disk, but the target tree can be saved in memory, which can save storage resources.

[0138] In this case, if the storage layer system is restarted due to a crash or other reasons, then after the restart, the storage layer system can obtain the version number in the latest version information stored in the disk as the system version number, and save the system version number in the memory. Also, after the restart, the storage layer system updates the file distribution status stored in the disk according to all the version information stored in the disk, and rebuilds the target tree in the memory according to the updated file distribution status. In this case, the updated file distribution status is the file distribution status under the latest version (i.e., the version corresponding to the system version number), and the file distribution status can indicate the files stored in each storage module in multiple storage modules under the latest version.

[0139] Since the file identifiers are globally ordered and the file identifiers correspond one-to-one to the leaf nodes, all the leaf nodes of the last layer in the target tree can be constructed based on all the file identifiers in the file distribution state and the minimum key value and the maximum key value in the file identified by each file identifier, and the mapping table in each leaf node is constructed based on the version number in the file distribution state (i.e., the version number of the latest version) and the identifier of the storage module where each file is located. At this time, the mapping table only contains the mapping relationship between the version number and the corresponding storage module identifier. Afterwards, the branch nodes are constructed layer by layer upwards according to the leaf nodes of the last layer until the root node is constructed, and the target tree is reconstructed. After the target tree is reconstructed, the pointer to the root node in the constructed target tree and the pointer to the last leaf node in the target tree are maintained in the memory.

[0140] It should be noted that after the target tree is constructed, the subsequent storage layer system can perform data processing based on the target tree, such as data storage, file migration, data query, etc.

[0141] Next, the process of storing data and updating the target tree in the storage layer system in the data processing method provided in the embodiment of the present application is described. The process may include the following steps A to E:

[0142] Step A: The storage layer system receives a data storage request, which carries a key-value pair to be stored, and the key value in the key-value pair is globally ordered.

[0143] The operation of step A is similar to that of the above step (1), and will not be described in detail in the present embodiment.

[0144] Step B: The storage layer system generates a new file containing one or more key-value pairs according to the order of the key values ​​in the key-value pairs, and stores the new file in a first storage module, which is one of the multiple storage modules; wherein the file identifiers of all files containing the key-value pairs are globally ordered.

[0145] The operation of step B is similar to that of the above step (2), and will not be described in detail in the present embodiment.

[0146] Step C: The storage layer system obtains a first version number, which is the sum of the latest system version number and 1 when the new file storage is completed.

[0147] The first version number is the version number generated after the storage layer system stores the new file, that is, the version number obtained by adding 1 to the latest system version number when the new file is stored. For example, assuming that the latest system version number when the new file is stored is 5, then the first version number is 6. In this case, version updates are strictly executed serially in the storage layer system.

[0148] After obtaining the first version number, the storage layer system can determine a mapping relationship between the first version number and the identifier of the first storage module, where the mapping relationship is used to indicate that the new file is stored in the first storage module under the version corresponding to the first version number.

[0149] Step D: The storage layer system adds a first leaf node after the last leaf node in the target tree, and updates the target tree based on the first leaf node. The first leaf node contains the file identifier of the new file, the minimum key value and the maximum key value of all key-value pairs in the new file, and the first mapping table. The first mapping table includes a mapping relationship between the first version number and the identifier of the first storage module.

[0150] The first leaf node is a leaf node newly added after the last leaf node in the target tree, that is, a new leaf node.

[0151] Optionally, the storage layer system may first obtain the pointer of the last leaf node in the target tree in the memory, and then add the first leaf node after the leaf node according to the pointer of the leaf node.

[0152] For example, the last leaf node in the target tree may be located at the rightmost side of the last layer of the target tree, in which case the leaf nodes are inserted from left to right. Then the storage layer system adds the first leaf node after the last leaf node in the target tree, that is, inserts the first leaf node at the rightmost side of the last layer of the target tree.

[0153] Alternatively, the last leaf node in the target tree may be located at the leftmost of the last layer of the target tree, in which case the leaf nodes are inserted from right to left. Then the storage layer system adds the first leaf node after the last leaf node in the target tree, that is, inserts the first leaf node at the leftmost of the last layer of the target tree.

[0154] In an embodiment of the present application, when storing data, there is no need to index in the target tree, and a new file can be directly generated for storage, and accordingly, a new leaf node can be directly added to the target tree to update the target tree, thereby improving data storage efficiency.

[0155] It should be noted that there is only one update logic for the target tree in the embodiment of the present application, that is, inserting a new leaf node after the last leaf node of the whole tree (such as the rightmost or leftmost of the last layer). The traditional tree structure adopts the logic of random insertion, which needs to first index downward from the root node to the leaf node, then insert and store data, and then backtrack to update or split the parent node. Compared with the random insertion logic in the traditional tree structure, the update logic of the target tree in the embodiment of the present application can avoid the indexing process from the root node to the leaf node, thereby improving data storage efficiency.

[0156] One point that needs to be explained is that since the file identifiers are globally ordered and each leaf node stores the file identifier of a file, the file identifiers in all leaf nodes in the last layer of the target tree exist in order from left to right or from right to left.

[0157] Another point to be explained is that the tree shape of the entire target tree in the embodiment of the present application is relatively fixed, except for the nodes in a path from the root node to the last leaf node (i.e., the rightmost path or the leftmost path), the remaining nodes are static nodes. A static node means that the node will not undergo a modification process and the overall shape is determined.

[0158] In some embodiments, the target tree is an n-ary tree, where n is an integer greater than or equal to 2. When the target tree is an n-ary tree, node splitting is not required in the process of updating the target tree according to the first leaf node, thereby improving update efficiency.

[0159] Optionally, the operation of the storage layer system updating the target tree according to the first leaf node can be: the storage layer system updates the nodes layer by layer in the target tree according to the first leaf node until the root node is updated. In the process of updating the nodes layer by layer upward, if the original node in the target tree needs to be updated, a write lock is added to the original node, and the write lock is released after the update; in the process of updating the nodes layer by layer upward, if a new node is added to the target tree, there is no need to add a write lock to the new node.

[0160] It should be noted that the embodiment of the present application will first add a write lock to the original node when updating the original node in the target tree. In this case, during the update process of the original node, if a query operation on the original node occurs, it is necessary to wait until the original node is updated and the write lock is released before the query operation can be performed, so as to ensure the accuracy of data query.

[0161] In the embodiment of the present application, the new nodes added during the update process of the target tree do not need to be written with locks. This is because before the target tree is updated, the new nodes are not visible to the outside, so the data query process will naturally not pass through the new nodes, and there is no need to write locks.

[0162] In some embodiments, the operation of the storage layer system updating nodes layer by layer upward in the target tree according to the first leaf node may include the following steps a to f.

[0163] Step a: Set the first leaf node as the current node.

[0164] Step b: Determine whether the current node is a new node or an existing node in the target tree. If the current node is a new node, execute the following steps c to e; if the current node is an existing node, execute the following step f.

[0165] Step c: If the current node is a new node, determine whether the current node can be a child node of the last node in the upper layer. If the current node can be a child node of the last node in the upper layer, execute the following step d; if the current node cannot be a child node of the last node in the upper layer, execute the following step e.

[0166] For example, when the target tree is an n-ary tree, if the number of child nodes of the last node in the upper layer is less than n, the current node can be the child node of the last node in the upper layer; if the number of child nodes of the last node in the upper layer is equal to n, the current node cannot be the child node of the last node in the upper layer.

[0167] Step d: If the current node can be the child node of the last node in the upper layer, then the last node in the upper layer is used as the parent node of the current node, a write lock is added to the parent node of the current node, and the parent node of the current node is updated. After the update, the write lock of the parent node of the current node is released, and the parent node of the current node is made the current node, and step b and subsequent steps are re-executed.

[0168] If the current node can be the child node of the last node in the upper layer, then the last node in the upper layer can be updated as the parent node of the current node. The update here is to add the node information of the current node to the child node list of the last node in the upper layer.

[0169] Step e: If the current node cannot be the child node of the last node in the upper layer, then add a new node in the upper layer as the parent node of the current node, make the parent node of the current node the current node, and re-execute step b and its subsequent steps.

[0170] If the current node cannot be the child node of the last node in the upper layer, then a new node can be added after the last node in the upper layer as the parent node of the current node. In this case, the parent node of the current node includes a child node list, and the child node list includes the node information of the current node.

[0171] Step f: If the current node is the original node, add a write lock to the parent node of the current node, update the parent node of the current node, release the write lock of the parent node of the current node after the update, make the parent node of the current node the current node, and re-execute step b and its subsequent steps.

[0172] If the current node is an existing node, the target tree already has a parent node of the current node, so the parent node of the current node can be directly updated at this time. The update here is to update the node information of the current node included in the child node list in the parent node of the current node.

[0173] It should be noted that after the current node is re-determined in step d, step e or step f, before re-executing step b, it can be determined whether the current node is the original root node of the target tree.

[0174] If the current node is not the original root node of the target tree and is not a node at the same level as the original root node, then re-execute step b and subsequent steps.

[0175] If the current node is the original root node of the target tree, it is determined that the update of the target tree is completed.

[0176] If the current node is not the original root node of the target tree and is a node at the same level as the original root node, then a new root node needs to be added in the upper level as the parent node of the original root node and the current node. The new root node includes a child node list, which includes the node information of the original root node and the node information of the current node. In this way, the target tree is updated. In this case, the height of the target tree will increase by one level.

[0177] It should be noted that after the target tree is updated, the pointer of the root node in the target tree maintained in the memory and the pointer of the last leaf node in the target tree can be updated.

[0178] The behavior of updating the pointer of the root node in memory cannot be concurrent with the behavior of obtaining the pointer of the root node in memory. That is, if the pointer of the root node in memory is being updated, you need to wait until the update is completed before you can execute the operation of obtaining the pointer of the root node in memory; if you are obtaining the pointer of the root node in memory, you can only execute the operation of updating the pointer of the root node in memory after successfully obtaining the pointer of the root node. This is because the process of updating the pointer of the root node may cause the pointer of the root node to be in a transitional state, such as being null. In this case, if you obtain the pointer of the root node, an error will occur.

[0179] Step E: The storage layer system updates the system version number to the first version number.

[0180] After the target tree is updated, the storage layer system can update the system version number to the first version number. In this way, the storage layer system updates the system version number after performing the file storage operation.

[0181] In some embodiments, after updating the system version number, the storage layer system may store the version information of the version corresponding to the updated system version number in the disk.

[0182] Next, the process of file migration by the storage layer system in the data processing method provided in the embodiment of the present application is described. The process may include the following steps A to E:

[0183] Step A: The storage layer system migrates the first file in the second storage module to the third storage module, and the second storage module and the third storage module are different storage modules in the multiple storage modules.

[0184] The second storage module is a storage module that stores the first file before migration.

[0185] The first file is a file to be migrated. The number of the first file can be one or more.

[0186] The third storage module is the storage module to which the first file is to be migrated.

[0187] In some cases, if a storage module stores too many files, the storage layer system may migrate at least a portion of the files in the storage module to other storage modules (such as storage modules that store fewer files). Of course, the storage layer system may also migrate files in a storage module to other storage modules in other cases, and the embodiments of the present application are not limited to this.

[0188] Step B: The storage layer system obtains a second version number, which is the sum of the latest system version number when the first file migration is completed and 1.

[0189] The second version number is a version number generated after the first file migration is completed, that is, a version number obtained by adding 1 to the latest system version number when the first file migration is completed.

[0190] After acquiring the second version number, the storage layer system may determine a mapping relationship between the second version number and an identifier of the third storage module, where the mapping relationship is used to indicate that the first file is stored in the third storage module under a version corresponding to the second version number.

[0191] Step C: The storage layer system indexes a second leaf node in the target tree according to the file identifier of the first file, where the second leaf node is a leaf node that includes the file identifier of the first file.

[0192] In some embodiments, the operation of step C may include the following steps a to b:

[0193] Step a: When the target tree is an n-ary tree, the storage layer system determines the index information in the target tree according to the file identifier of the first file, n and the tree height of the target tree.

[0194] The index information in the target tree is the information needed when indexing a leaf node in the target tree.

[0195] Optionally, assuming that the height of the target tree is m, where m is an integer greater than or equal to 2. Then the index information in the target tree may include index information of each layer in the target tree, that is, may include index information of each layer from the 2nd layer to the mth layer.

[0196] The index information of the i-th layer is used to indicate the sorting order of the node of the i-th layer to be indexed in all child nodes of its parent node, where i is greater than or equal to 2 and less than or equal to m.

[0197] That is to say, after indexing a node in the i-1th layer, you need to continue to index the nodes in the i-th layer. In this case, you can index the next node from all the child nodes of this node in the i-1th layer based on the index information in the i-th layer. For example, if the index information in the second layer is 0, then after indexing the node in the first layer, that is, the root node, you can use the child node with a sorting number of 0 among all the child nodes of the root node as the next node to be indexed, and the next node is a node in the second layer.

[0198] As an example, the storage layer system can obtain the file identifier in the leaf node according to the pointer of the last leaf node in the target tree maintained in the memory, and add 1 to the target value corresponding to the file identifier to obtain the number of leaf nodes in the target tree. When the number of leaf nodes in the target tree and the number of forks n of the target tree are known, the tree height m of the target tree can be determined.

[0199] The target value corresponding to a file identifier is the sorting number of the file identified by the file identifier among all files. The sorting number starts from 0 and increases by 1. That is, the sorting number can be 0, 1, 2, 3, ...

[0200] There is a corresponding relationship between the file identifier and the target value. Every time a new file is added to the storage layer system, the sorting sequence number of the new file among all files can be used as the target value corresponding to the file identifier of the new file.

[0201] Since the file identifiers are globally ordered, the corresponding target value can be determined for any file identifier.

[0202] For example, if the file identifier starts from 0 and increases by 1, that is, the file identifier is 0, 1, 2, 3, ..., then a file identifier is the same as its corresponding target value.

[0203] For another example, if the file identifier is incremented by a fixed value starting from 0, assuming that the fixed value is j, and j is an integer greater than or equal to 2, then the file identifiers are 0, j, 2j, 3j, ... In this case, the target value corresponding to a file identifier is the value obtained by dividing the file identifier by j.

[0204] Of course, file identifiers can also exist in other orderly forms. For example, file identifiers can be a, b, c, etc. In this case, the file identifiers can be converted into corresponding target values ​​according to certain rules. For example, the target value corresponding to file identifier a is 0, the target value corresponding to file identifier b is 1, the target value corresponding to file identifier c is 2, and so on.

[0205] Optionally, assume that the tree height of the target tree is m, where m is an integer greater than or equal to 2. The operation of step a may be: the storage layer system adds a read lock to the root node of the target tree. Determine the target value corresponding to the file identifier of the first file, where the target value corresponding to the file identifier of the first file is the sorting number of the first file among all files. Let i be m, and let the specified parameter be the target value corresponding to the file identifier of the first file. Divide the specified parameter by n to obtain the quotient and remainder, and use the remainder as the index information of the i-th layer. If i is not 2, let i=i-1, let the specified parameter be the quotient, and re-execute the above steps of dividing the specified parameter by n to obtain the quotient and remainder and subsequent steps until i is 2; if i is 2, index the root node, and release the read lock of the root node after indexing the root node.

[0206] It should be noted that the embodiment of the present application needs to add a read lock to the root node in the process of determining the index information in the target tree. This is because if a new root node is added in the process of determining the index information in the target tree, it will cause the index information determined according to the old root node to start indexing from the new root node. For this reason, the embodiment of the present application first adds a read lock to the root node before determining the index information in the target tree to prevent other threads from modifying the root node. After determining the index information in the target tree, the root node is indexed first, and the read lock of the root node is released after the root node is indexed. In this way, it can be ensured that the root node at the beginning of the indexing process is consistent with the root node when the index information is determined, thereby ensuring the correctness of the indexing process.

[0207] In addition, in the process of determining the index information of the target tree, the embodiment of the present application adds a read lock to the root node, which will not affect other data indexing processes. In other words, different processes of indexing leaf nodes through file identifiers can be completely concurrent.

[0208] It should be noted that the specified parameter is divided by n to obtain the quotient and remainder. The quotient represents the sorting number of the parent node of the node of the i-th layer to be indexed among all the nodes of the i-1 layer. The remainder is the sorting number of the node of the i-th layer to be indexed among all the child nodes of its parent node. Based on this, after indexing the nodes of the i-1 layer, you can continue to index the nodes of the i-th layer.

[0209] In the embodiment of the present application, when determining the index information in the target tree, the index information of the mth layer is determined first, and then the index information of the m-1th layer, the index information of the m-2th layer, ..., is determined in sequence until the index information of the 2nd layer is determined. When indexing, after indexing to the root node, the index information of the 2nd layer, the index information of the 3rd layer, ..., the index information of the mth layer is sequentially indexed downward to the leaf nodes layer by layer.

[0210] Step b: The storage layer system indexes the second leaf node in the target tree according to the index information in the target tree.

[0211] It should be noted that the embodiment of the present application can directly determine the index path from the root node to the second leaf node based on the index information in the target tree. There is no need to read the node data in this process. Therefore, the process of indexing the second leaf node according to the index information in the target tree does not require a read lock.

[0212] In the embodiment of the present application, only m-1 calculations are required to determine the index information in the target tree, and the index path can be directly determined according to the index information in the target tree. In this way, the indexing process is less complex and the indexing efficiency is higher.

[0213] Combine the following Figure 5 The process of determining the index information in the target tree is described with an example.

[0214] like Figure 5 As shown in Figure (b), the target tree is a binary tree, and the height of the target tree is 4.

[0215] Assume that the target value corresponding to the file identifier of the first file is 6, such as Figure 5 As shown in Figure (a), first, determine the index information of the 4th layer. Specifically, let the specified parameter be 6, divide 6 by 2, and the quotient is 3 and the remainder is 0, then determine that the index information of the 4th layer is 0.

[0216] Then, continue to determine the index information of the third layer. Specifically, let the specified parameter be 3, divide 3 by 2, and obtain a quotient of 1 and a remainder of 1, then determine that the index information of the third layer is 1.

[0217] Afterwards, continue to determine the index information of the second layer. Specifically, let the specified parameter be 1, divide 1 by 2, and the quotient is 0 and the remainder is 1, then determine that the index information of the second layer is 1.

[0218] So far, the index information of each layer from the 2nd layer to the 4th layer in the target tree has been determined.

[0219] When indexing is performed later based on the index information of each layer from the second layer to the fourth layer, Figure 5 As shown in Figure (b), after indexing the node of the first layer, that is, the root node, according to the index information of the second layer, it can be determined that the node of the second layer to be indexed is the child node with a sorting sequence number of 1 among all the child nodes of the root node. After indexing a node of the second layer, according to the index information of the third layer, it can be determined that the node of the third layer to be indexed is the child node with a sorting sequence number of 1 among all the child nodes of this node of the second layer. After indexing a node of the third layer, according to the index information of the fourth layer, it can be determined that the node of the fourth layer to be indexed is the child node with a sorting sequence number of 0 among all the child nodes of this node of the third layer. In this way, the corresponding leaf node, that is, the second leaf node, is indexed.

[0220] Step D: The storage layer system adds a mapping relationship between the second version number and the identifier of the third storage module in the mapping table in the second leaf node.

[0221] In some embodiments, the mapping table is a bidirectional linked list, and each node in the bidirectional linked list includes a version number and a storage module identifier.

[0222] In this case, the operation of step D may be: the storage layer system adds a node to the tail of the bidirectional linked list in the second leaf node, and the node includes the second version number and the identifier of the third storage module.

[0223] It should be noted that because the behavior of adding nodes during the above file migration is based on the tail node of the bidirectional linked list, the tail node (only a single node) requires a write lock to ensure its concurrent safety. In other words, when a node needs to be added, a write lock is first added to the tail node, and then a node is added after the tail node, and then the write lock is released.

[0224] Step E: The storage layer system updates the system version number to the second version number.

[0225] After the storage layer system adds the mapping relationship between the second version number and the identifier of the third storage module in the mapping table in the second leaf node, the system version number can be updated to the second version number. In this way, the storage layer system updates the system version number after performing the file migration operation.

[0226] Next, the process of data query by the storage layer system in the data processing method provided in the embodiment of the present application is explained.

[0227] Figure 6 is a flowchart of a data processing method provided in an embodiment of the present application, specifically a flowchart of a data query process. Figure 6 The method may include the following steps 601 to 605:

[0228] Step 601: If the storage layer system receives a data query request, it obtains the target version number. The data query request carries a target key value. The target version number is the latest system version number when the data query request is received. The update of the system version number is triggered by any one of the file storage operation and file migration operation.

[0229] The target key value is the key value in the key-value pair to which the value to be queried belongs.

[0230] The data query request is used to query the value in the key-value pair to which the target key value belongs.

[0231] The data query request may be sent by an external system, such as a database system, a blockchain system, etc., which is not limited in the embodiments of the present application.

[0232] Step 602: The storage layer system determines the target leaf node indexed by the target key value in the target tree. The leaf node in the target tree contains a file identifier, the minimum key value and the maximum key value in all key-value pairs in the file identified by the file identifier, and a mapping table. The mapping table includes a mapping relationship between a version number and a storage module identifier. The mapping table is used to indicate the storage module where the file identified by the file identifier is located in each version.

[0233] The target key value is greater than or equal to the minimum key value in the target leaf node, and less than or equal to the maximum key value in the target leaf node.

[0234] For example, the target leaf node indexed by the target key value in the target tree may also be referred to as the target leaf node to which the target key value is distributed in the target tree.

[0235] Optionally, the storage layer system can index the target leaf node in the target tree by binary search according to the target key value. Of course, the target leaf node can also be indexed in the target tree by other methods, which is not limited to the embodiments of the present application.

[0236] For example, if the target tree is an n-ary tree, the complexity of the indexing process satisfies O(logN)×log2branch. The complexity of the tree index path is O(logN), the complexity of the child node specified by binary search in each node is a constant value log2branch, and the branch value is a fixed fork number constant n.

[0237] In some embodiments, the operation of step 603 may be: the storage layer system indexes nodes layer by layer from the root node downward in the target tree according to the target key value until the target leaf node is indexed.

[0238] As an example, in the process of indexing nodes layer by layer downward, each time a node is indexed, a read lock is added to the node, and the next node is indexed based on the node and the target key value. The read lock of the node is released after the next node is indexed; the read lock of the target leaf node is released after the file identifier and mapping table in the target leaf node are obtained.

[0239] Specifically, after obtaining the target version number, the storage layer system can first obtain the pointer of the root node in the memory, and then index the root node according to the pointer of the root node. After indexing the root node, a read lock is added to the root node.

[0240] After that, determine which child node of the root node the target key value is in the key range of. This process is called indexing the next node. After determining that the target key value is in the key range of a child node of the root node, this child node is the next node to be indexed. At this time, the read lock of the root node is released and the read lock of the newly indexed node is added.

[0241] If this node is a branch node, then we can continue to determine which child node of this node the target key value is in, that is, continue to index the next node until the indexed node is a leaf node.

[0242] If this node is a leaf node, then it can be determined that this node is the target leaf node. After obtaining the file identifier and mapping table in the target leaf node, the read lock of the target leaf node is released.

[0243] As another example, in the process of indexing nodes downward layer by layer, each time a node is indexed, if this node is the last child node among all child nodes of its parent node, a read lock is added to this node, and the next node is indexed based on this node and the target key value. The read lock of this node is released after the next node is indexed; if this node is not the last child node among all child nodes of its parent node, a read lock is not added to this node, and the next node is directly indexed based on this node and the target key value. In addition, in this case, there is no need to add a read lock to all subsequently indexed nodes, which can save lock resources.

[0244] Among them, if a read lock is added to the target leaf node during the indexing process, the read lock of the target leaf node is released after the file identifier and mapping table in the target leaf node are obtained.

[0245] It should be noted that in the embodiment of the present application, the read lock and the read lock are shared locks, the read lock and the write lock are mutually exclusive locks, and the write lock and the write lock are mutually exclusive locks.

[0246] Optionally, the storage layer system in the embodiment of the present application may be a concurrent model of single-threaded writing and multi-threaded reading.

[0247] In this case, after one thread adds a read lock to a node, it does not affect another thread adding a read lock to the node.

[0248] After a thread adds a read lock to a node, another thread cannot add a write lock to the node. It must wait until the read lock of the node is released before adding a write lock to the node and then continuing operations (such as continuing to update the node, etc.). Similarly, after a thread adds a write lock to a node, another thread cannot add a read lock to the node. It must wait until the write lock of the node is released before adding a read lock to the node and then continuing operations (such as continuing to index the node, etc.).

[0249] In the embodiment of the present application, there will be at most one lock conflict (also called lock preemption) in a tree indexing process and a tree updating process. That is, the tree structure of the target tree in the embodiment of the present application can avoid path-level lock conflicts to the greatest extent, thereby maximizing system concurrency and reducing the main business process delay.

[0250] It should be noted that all data query behaviors in the embodiments of the present application can be concurrent, which is very friendly to the scenario of concurrent data reading in the system. For example, if the blockchain system supports concurrent execution of transactions, then all behaviors of obtaining account book data during concurrent execution of transactions can also be fully concurrent in the system.

[0251] In addition, the node insertion behavior in the embodiment of the present application cannot be concurrent, that is, the next update can only be performed after the target tree is updated once.

[0252] Step 603: The storage layer system obtains the target storage module identifier from the mapping table in the target leaf node according to the target version number.

[0253] The storage module identified by the target storage module identifier is the storage module where the file identified by the file identifier in the target leaf node is located under the version corresponding to the target version number.

[0254] Since the target version number is the latest system version number of the storage layer system when it receives the data query request, and the mapping relationship between the version number and the storage module identifier is stored in the mapping table in the target leaf node, it is possible to determine based on the target version number and the mapping table which storage module identifier (i.e., the target storage module identifier) ​​in which the file containing the target key value is stored.

[0255] In some embodiments, the operation of step 603 may be: the storage layer system obtains, from the mapping table in the target leaf node, the storage module identifier to which the maximum version number among all version numbers less than or equal to the target version number is mapped as the target storage module identifier.

[0256] That is to say, if the target version number is recorded in the mapping table, then it can be determined that the storage module identifier to which the target version number is mapped is the identifier of the storage module where the file identified by the file identifier in the target leaf node is located under the version corresponding to the target version number, and thus the storage module identifier can be used as the target storage module identifier.

[0257] If the target version number is not recorded in the mapping table, then the maximum version number among all version numbers in the mapping table that are smaller than the target version number can be determined. The file identified by the file identifier in the target leaf node has not been migrated from the version corresponding to the maximum version number to the version corresponding to the target version number, so it can be determined that the storage module where the file is located under the version corresponding to the maximum version number is the storage module where the file is located under the version corresponding to the target version number, so the storage module identifier to which the maximum version number is mapped can be used as the target storage module identifier.

[0258] In some embodiments, when the mapping table is a doubly linked list, the storage layer system can start searching from the end of the doubly linked list when obtaining the target storage module identifier from the doubly linked list. This is because the latest system version number tends to be used when querying data, so starting the search from the end of the doubly linked list will find the corresponding node (i.e., the node containing the maximum version number of all version numbers less than or equal to the target version number and the target storage module identifier) ​​faster.

[0259] It should be noted that because the behavior of searching for nodes during data query is based on the tail node of the bidirectional linked list, the tail node (only a single node) requires a read lock to ensure its concurrent safety. In other words, when you need to search for a node, first add a read lock to the tail node, then search forward from the tail node, and release the read lock after finding the corresponding node.

[0260] Step 604: The storage layer system obtains the value in the key-value pair to which the target key value belongs from the file whose file identifier in the storage module identified by the target storage module identifier is the file identifier in the target leaf node.

[0261] Optionally, after obtaining the value, the storage layer system may return a data query result to the external system, where the data query result carries the value.

[0262] In some embodiments, the storage layer system can support concurrent reading, so multiple versions can coexist and run in the storage layer system. To this end, it is necessary to control and release multiple versions.

[0263] In this case, after the storage layer system obtains the target version number in step 601, the reference count of the target version number can be increased by 1. Afterwards, after the storage layer system obtains the value in the key-value pair to which the target key value belongs in step 604, the reference count of the target version number can be decreased by 1.

[0264] As an example, the reference count has an initial value, and the initial value can be set to 0. That is, after the storage layer system updates the system version number each time, the reference count of the latest system version number can be set to 0.

[0265] In this case, the reference count of the target version number is the total number of data query operations in progress under the version corresponding to the target version number.

[0266] In the process of multi-version management, the storage layer system needs to release historical versions (i.e., versions other than the version corresponding to the latest system version number). Therefore, reference counting can be used to determine whether a historical version meets the release conditions.

[0267] Specifically, if the reference count of a historical version number (that is, any version number except the latest system version number) is 0, it means that the storage layer system is not currently performing data query operations based on the historical version corresponding to this historical version number, that is, the historical version is not currently in use and meets the release conditions, so the historical version can be released.

[0268] If the reference count of a historical version number is greater than 0, it means that the storage layer system is performing one or more data query operations based on the historical version corresponding to this historical version number, that is, the historical version is currently in use and does not meet the release conditions, so the historical version will not be released.

[0269] As an example, the reference count has an initial value, and the initial value can be set to 1. That is, each time the storage layer system updates the system version number, the reference count of the latest system version number can be set to 1, and in this case, the reference count of the previous version number of the latest system version number can also be reduced by 1.

[0270] In this case, the reference count of the target version number can indicate whether the version corresponding to the target version number is currently in use. For example, if the reference count of the target version number is 1, it means that the version corresponding to the target version number may be the current latest version (that is, the version corresponding to the latest system version number), or the version corresponding to the target version number may be a historical version and data query is being performed based on the historical version.

[0271] In the process of managing multiple versions, the storage layer system needs to release versions, so it can determine whether a version meets the release conditions through reference counting.

[0272] Specifically, if the reference count of a version number (whether the latest system version number or the historical version number) is 0, it means that the storage layer system is not currently using the version corresponding to this version number, and the version meets the release conditions, so the version can be released.

[0273] If the reference count of a version number is greater than 0, it means that the storage layer system is currently using the version corresponding to this version number. This version does not meet the release conditions, so it will not be released.

[0274] In some embodiments, the operation of the storage layer system releasing the version may be: the storage layer system releases the version according to the version information of the next version of the version.

[0275] Specifically, if the version information of the next version indicates that only the storage module adds files, but no storage module reduces files, then releasing the version means only deleting the reference count of the version number of the version. If the version information of the next version indicates that a storage module adds files, and a storage module (which may be called the fourth storage module) reduces files (which may be called the second file), then releasing the version means deleting the second file from the fourth storage module, and deleting all mapping relationships between version numbers and storage module identifiers whose version numbers are less than or equal to the version number of the version from the mapping table in the leaf node of the target tree that contains the file identifier of the second file, and finally deleting the reference count of the version number of the version.

[0276] In some embodiments, the mapping table in the leaf node is a doubly linked list, so when releasing a version, when it is necessary to delete the mapping relationship in the doubly linked list in the leaf node, a node can be directly deleted from the head of the doubly linked list. This is because the oldest version is usually deleted when deleting.

[0277] It should be noted that in the embodiment of the present application, for the deletion scenario, the logic of lock-free deletion can be implemented based on the bidirectional linked list structure. This is because of the following two reasons:

[0278] 1. In the embodiment of the present application, the nodes corresponding to the same version in the doubly linked list meet the logical clock order of being created first and then deleted. Moreover, for a certain version, when there is no subsequent indexing behavior, the release of the version is triggered, that is, the deletion of the specified node in the doubly linked list in the leaf node is triggered. Therefore, no additional concurrency control logic is required in the doubly linked list.

[0279] 2. By introducing the head pointer, the bidirectional linked list can completely control the node deletion behavior within the scope of "only operating the node corresponding to the head pointer", so the process can be operated without locks.

[0280] Based on the above reasons, the bidirectional linked list in the embodiment of the present application can realize the maximum degree of safe concurrent read and write logic, thereby ensuring the throughput performance under high access frequency.

[0281] In an embodiment of the present application, the storage layer system stores files through multiple storage modules, and the multiple storage modules can migrate files, which can improve data storage capacity and data storage flexibility. In this case, both file storage operations and file migration operations will trigger version updates. For this reason, the embodiment of the present application also stores a mapping table in the leaf nodes in the target tree. According to the mapping table, the storage module where the file is located under each version can be determined, so that after receiving a data query request, the required value can be obtained from the corresponding storage module, so that data query can be accurately implemented.

[0282] Figure 7 is a structural diagram of a data processing device provided in an embodiment of the present application. The device can be implemented by software, hardware or a combination of both to become part or all of a computer device, and the computer device can be the following Figure 8 Computer equipment shown. Figure 7 The device includes: a first acquisition module 701, a determination module 702, a second acquisition module 703, and a third acquisition module 704.

[0283] The first acquisition module 701 is used to acquire a target version number if a data query request is received. The data query request carries a target key value. The target version number is the latest system version number when the data query request is received. The update of the system version number is triggered by any one of a file storage operation and a file migration operation.

[0284] Determine module 702, used to determine the target leaf node indexed by the target key value in the target tree, the leaf node in the target tree includes a file identifier, the minimum key value and the maximum key value in all key-value pairs in the file identified by the file identifier, and a mapping table, the mapping table includes a mapping relationship between a version number and a storage module identifier, and the mapping table is used to indicate the storage module where the file identified by the file identifier is located under each version;

[0285] The second acquisition module 703 is used to acquire the target storage module identifier from the mapping table in the target leaf node according to the target version number;

[0286] The third acquisition module 704 is used to obtain the value in the key-value pair to which the target key value belongs from the file whose file identifier in the storage module identified by the target storage module identifier is the file identifier in the target leaf node.

[0287] In an embodiment of the present application, the storage layer system stores files through multiple storage modules, and the multiple storage modules can migrate files, which can improve data storage capacity and data storage flexibility. In this case, both file storage operations and file migration operations will trigger version updates. For this reason, the embodiment of the present application also stores a mapping table in the leaf nodes in the target tree. According to the mapping table, the storage module where the file is located under each version can be determined, so that after receiving a data query request, the required value can be obtained from the corresponding storage module, so that data query can be accurately implemented.

[0288] It should be noted that: when processing data, the data processing device provided in the above embodiment only uses the division of the above functional modules as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0289] The functional units and modules in the above embodiments may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit, and the above integrated units may be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present application.

[0290] The data processing device and data processing method embodiments provided in the above embodiments belong to the same concept. The specific working process of the units and modules in the above embodiments and the technical effects brought about can be found in the method embodiment part and will not be repeated here.

[0291] Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 8 As shown, the computer device 8 includes: a processor 80, a memory 81, and a computer program 82 stored in the memory 81 and executable on the processor 80. When the processor 80 executes the computer program 82, the steps of the data processing method in the above embodiment are implemented.

[0292] The computer device 8 may be a general-purpose computer device or a dedicated computer device. In a specific implementation, the computer device 8 may be the storage layer system mentioned above, and may specifically be a desktop computer, a portable computer, a network server, a PDA, a mobile phone, a tablet computer, a wireless terminal device, a communication device or an embedded device. The embodiment of the present application does not limit the type of the computer device 8. Those skilled in the art will appreciate that Figure 8 It is only an example of the computer device 8 and does not constitute a limitation on the computer device 8. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, such as input and output devices, network access devices, etc.

[0293] The processor 80 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0294] In some embodiments, the memory 81 may be an internal storage unit of the computer device 8, such as a hard disk or memory of the computer device 8. In other embodiments, the memory 81 may also be an external storage device of the computer device 8, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 8. Further, the memory 81 may also include both an internal storage unit and an external storage device of the computer device 8. The memory 81 is used to store an operating system, an application program, a boot loader, data, and other programs. The memory 81 may also be used to temporarily store data that has been output or is to be output.

[0295] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above method embodiments, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of each of the above method embodiments can be implemented. Among them, the computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, ROM (Read-Only Memory), RAM (Random Access Memory), CD-ROM (Compact Disc Read-Only Memory), magnetic tape, floppy disk and optical data storage device. The computer-readable storage medium mentioned in the present application can be a non-volatile storage medium, in other words, it can be a non-transient storage medium.

[0296] It should be understood that all or part of the steps to implement the above embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The computer instructions can be stored in the above-mentioned computer readable storage medium.

[0297] The above are optional embodiments provided for the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the technical scope disclosed in the present application shall be included in the protection scope of the present application.

Claims

1. A data processing method, It is characterized in that The method is applied to a storage layer system, the storage layer system includes a plurality of storage modules, each of the plurality of storage modules is used to store files, and files can be migrated between the plurality of storage modules, the method includes: If a data query request is received, the target version number is obtained. The data query request carries a target key value. The target version number is the latest system version number when the data query request is received. The update of the system version number is triggered by any one of the file storage operation and the file migration operation. Determine a target leaf node indexed by the target key value in a target tree, wherein the leaf node in the target tree includes a file identifier, a minimum key value and a maximum key value in all key-value pairs in the file identified by the file identifier, and a mapping table, wherein the mapping table includes a mapping relationship between a version number and a storage module identifier, and the mapping table is used to indicate the storage module where the file identified by the file identifier is located under each version; Acquire a target storage module identifier from a mapping table in the target leaf node according to the target version number; From the file whose file identifier in the storage module identified by the target storage module identifier is the file identifier in the target leaf node, obtain the value in the key-value pair to which the target key value belongs.

2. The method according to claim 1, It is characterized in that The method further comprises: Receive a data storage request, the data storage request carrying a key-value pair to be stored, the key values ​​in the key-value pair being globally ordered; Generate a new file containing one or more key-value pairs according to the order of the key values ​​in the key-value pairs, and store the new file in a first storage module, which is one of the multiple storage modules; wherein the file identifiers of all files containing the key-value pairs are globally ordered; Obtaining a first version number, where the first version number is the sum of the latest system version number and 1 when the new file is stored; Adding a first leaf node after the last leaf node in the target tree, and updating the target tree according to the first leaf node, wherein the first leaf node includes a file identifier of the new file, a minimum key value and a maximum key value in all key-value pairs in the new file, and a first mapping table, wherein the first mapping table includes a mapping relationship between the first version number and an identifier of the first storage module; The system version number is updated to the first version number.

3. The method according to claim 1, It is characterized in that The method further comprises: Migrating a first file in a second storage module to a third storage module, where the second storage module and the third storage module are different storage modules among the multiple storage modules; Obtain a second version number, where the second version number is the sum of the latest system version number when the first file migration is completed and 1; Indexing a second leaf node in the target tree according to the file identifier of the first file, where the second leaf node is a leaf node including the file identifier of the first file; Adding a mapping relationship between the second version number and the identifier of the third storage module in the mapping table in the second leaf node; The system version number is updated to the second version number.

4. The method according to claim 3, It is characterized in that The step of acquiring the target storage module identifier from the mapping table in the target leaf node according to the target version number includes: From the mapping table in the target leaf node, a storage module identifier to which the maximum version number among all version numbers that are less than or equal to the target version number is mapped is obtained as the target storage module identifier.

5. The method according to claim 1, It is characterized in that The system version number is stored in the memory, and the method further includes: After each update of the system version number, the version information of the version corresponding to the updated system version number is stored in the disk. The version information includes the version number and version increment information. The version increment information is used to indicate the file changes in the storage module under the version corresponding to the version number compared with the previous version.

6. The method according to claim 5, It is characterized in that The method further comprises: According to one or more version information stored in the disk, the file distribution status stored in the disk is updated, the file distribution status includes the correspondence between the version number, the storage module identifier and the file identifier, and the file distribution status is used to indicate the files stored in each storage module in the multiple storage modules under the corresponding version.

7. The method according to claim 6, It is characterized in that The method further comprises: After restarting, obtaining the version number in the latest version information stored in the disk as the system version number; Storing the system version number in the memory; The target tree is located in the memory, and the method further comprises: After restarting, updating the file distribution status stored in the disk according to all version information stored in the disk; The target tree is reconstructed in the memory according to the updated file distribution state.

8. The method according to claim 1, It is characterized in that After obtaining the target version number, the following steps are also included: Increment the reference count of the target version number by 1; After obtaining the value in the key-value pair to which the target key value belongs, the method further includes: Decrement the reference count of the target version number by 1; The method further comprises: For any version number other than the latest system version number, if the reference count of the version number is 0, the version corresponding to the version number is released.

9. The method according to any one of claims 1 to 8, It is characterized in that The mapping table is a bidirectional linked list, and each node in the bidirectional linked list contains a version number and a storage module identifier.

10. A computer device, It is characterized in that The computer device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the method according to any one of claims 1 to 9 when executed by the processor.

11. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Data processing method, database system, computer equipment and storage medium

    CN116069788A

  • Data storage method and device, equipment and storage medium

    CN116301597A

  • Data processing method, database system, computer equipment and storage medium

    CN116431632A

  • Data processing method and device for graph database, equipment and storage medium

    CN116561382A

  • Software updating method and device, electronic equipment and storage medium

    CN117032756A

Cited By

  • Method, device and equipment for data migration, medium and product

    CN119088760A

  • Data processing method and device, equipment and storage medium

    CN119226332A

  • Data processing method, device, equipment and storage medium

    CN119226332B

  • Software package installation method and software package installation device

    CN120215967A

  • Software package installation method and software package installation apparatus

    CN120215967B