Block chain data storage method and device and computer equipment
By setting the current data storage structure and historical data storage structure in the blockchain data storage system, combined with the use of identifying the data storage structure, the problem of low read and write efficiency of blockchain data is solved, and the separation of new and old data is realized, and the reading and writing efficiency is improved.
Patent Information
- Application Number
- CN202411952571.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-03-21
AI Technical Summary
The reading and writing efficiency of blockchain data in the prior art is low, mainly due to the traceability of blockchain, which leads to increasing amounts of data. Reading and writing operations require frequent access and processing of historical data, resulting in additional reading and writing overhead.
By setting the current data storage structure and the historical data storage structure in the data storage system, it is used to store new data and old data respectively, and by identifying the data storage structure, the old data that needs to be stored in the historical data storage structure is identified and extracted, reducing the additional reading of the old data when accessing the new data.
It realizes separate storage of old and new data, reduces the reading of old data when accessing new data, avoids additional data reading and writing, and thus improves the reading and writing efficiency of blockchain data.
Smart Images

Figure CN119669365A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a blockchain data storage method, device and computer equipment. Background Art
[0002] With the development of big data technology, big data applications are becoming more and more extensive. For example, for the storage application of blockchain data, the underlying database can be a database with storage structures such as B-tree (Balanced Tree), B+ tree, LSM tree (Log-Structured Merge Tree) as the core.
[0003] The data in the blockchain generally meets two characteristics: traceability and verifiability. Traceability means that the current data of the blockchain can be derived from scratch, that is, the blockchain saves the previous data and will not be deleted because it is outdated (that is, when a piece of data is modified, the data before the modification will still be saved and will not be deleted).
[0004] At present, due to the traceability of blockchain, there is more and more blockchain data. During the implementation of relevant blockchain data reading and writing technologies, applicants have found that there is at least a problem of low data reading and writing efficiency. Summary of the invention
[0005] Based on this, the purpose of this application is to solve at least one of the above-mentioned technical defects, especially the technical defect of low blockchain reading and writing efficiency in the prior art. This application provides a blockchain data storage method, device and computer equipment.
[0006] In a first aspect, the present application provides a blockchain data storage method, which is applied to a pre-established data storage system, wherein the data storage system includes a current data storage structure and a historical data storage structure; the data storage structures each include a temporary storage area and a permanent storage area; the method includes:
[0007] In the case of modifying the historical data stored in the current data storage structure, determining the storage location of the historical data, and storing the current data obtained by modifying the historical data into the current data storage structure;
[0008] If the storage location is a temporary storage area of the current data storage structure, the historical data in the temporary storage area is stored in the historical data storage structure;
[0009] If the storage location is a permanent storage area of the current data storage structure, determining a data identifier corresponding to the historical data;
[0010] The historical data extracted from the permanent storage area based on the data identifier is stored in the historical data storage structure.
[0011] In one embodiment, the data storage system further comprises identifying a data storage structure;
[0012] The historical data extracted from the permanent storage area based on the data identifier is stored in the historical data storage structure, including:
[0013] Storing data identifiers corresponding to historical data in an identification data storage structure;
[0014] Determining, from a permanent storage area of the current data storage structure, a target data identifier that matches a data identifier stored in the identification data storage structure;
[0015] The historical data corresponding to the target data identifier is extracted, and the historical data is stored in the historical data storage structure.
[0016] In one embodiment, the temporary storage area includes modifiable storage units, and the permanent storage area includes a plurality of storage levels stored progressively;
[0017] Determining, from a permanent storage area of the current data storage structure, a target data identifier that matches a data identifier stored in the identified data storage structure, including:
[0018] In the case where the storage layer of the current data storage structure overflows, obtaining the first data identifier of the current layer of the data overflow and the first data identifier of the next layer in the current data storage structure;
[0019] Acquire a second data identifier of a current level corresponding to a data overflow level in an identification data storage structure, and a second data identifier of a next level; wherein the next level is a level that is progressively stored next to the current level;
[0020] A target data identifier matching the second data identifier is determined from the first data identifier.
[0021] In one embodiment, the method further comprises:
[0022] Determine a target hierarchical ordering of a current hierarchical level of data overflow in a permanent storage area of a current data storage structure;
[0023] A level in the permanent storage area of the data storage structure having the same order as the target level is identified as the current level corresponding to the data overflow level.
[0024] In one embodiment, storing the data identifier corresponding to the historical data in the identification data storage structure includes:
[0025] storing data identifiers corresponding to the historical data in a temporary storage area that identifies the data storage structure;
[0026] When the data stored in the temporary storage area of the current data storage structure overflows, the identification data in the temporary storage area of the identification data storage structure is stored in the permanent storage area of the identification data storage structure.
[0027] In one of the embodiments, the identification data storage structure is used to store the data identifier and is not used to store the historical data corresponding to the data identifier.
[0028] In one embodiment, determining a storage location of historical data includes:
[0029] Obtain the storage status of historical data in the temporary storage area of the current data storage structure;
[0030] If the storage state indicates that historical data exists in the temporary storage area, the storage location is the temporary storage area of the current data storage structure;
[0031] If the storage state indicates that historical data exists in the temporary storage area, the storage location is the permanent storage area of the current data storage structure.
[0032] In one embodiment, the method further comprises:
[0033] In response to a modification instruction for historical data stored in the current data storage structure, obtaining a read verification result of reading and verifying the historical data;
[0034] If the read verification result indicates that the read verification is passed, the current data obtained by modifying the historical data will be obtained, and the data identifier of the historical data will be determined.
[0035] In a second aspect, the present application provides a blockchain data storage device, which is applied to a pre-established data storage system, wherein the data storage system includes a current data storage structure and a historical data storage structure; the data storage structures each include a temporary storage area and a permanent storage area; the device includes:
[0036] A storage location determination module, for determining the storage location of historical data when modifying historical data stored in the current data storage structure, and storing the current data obtained by modifying the historical data into the current data storage structure;
[0037] A direct storage module, for storing the historical data in the temporary storage area to the historical data storage structure if the storage location is a temporary storage area of the current data storage structure;
[0038] an identification determination module, for determining a data identification corresponding to the historical data if the storage location is a permanent storage area of the current data storage structure;
[0039] The extraction storage module is used to store the historical data extracted from the permanent storage area based on the data identifier into the historical data storage structure.
[0040] In a third aspect, the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0041] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0042] The blockchain data storage method, device and computer equipment provided by the present application can store current data and historical data separately by providing a current data storage structure and a historical data storage structure, that is, the new and old data can be analyzed to reduce the additional reading of old data when accessing new data, which is beneficial to improving the reading and writing efficiency of blockchain data. The method provided by the present application can determine whether the historical data stored in the current data storage structure is stored in the temporary storage area of the current data storage structure when the historical data needs to be modified. If so, the historical data can be directly stored in the historical data storage structure; if not, the data identifier of the historical data can be recorded, and the historical data can be extracted from the permanent storage area of the current data storage structure based on the data identifier, and stored in the historical data storage structure. At the same time, by storing the modified current data in the current data storage structure, the separation of new and old data can be achieved, that is, the new and old data are stored separately, reducing the need to read old data when accessing new data, avoiding additional data reading, and thus improving the reading and writing efficiency of blockchain data. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art 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 paying creative labor.
[0044] Figure 1 A schematic diagram of an LSM tree storage structure provided in an embodiment of the present application;
[0045] Figure 2 A schematic diagram of an application function environment of a blockchain data storage method provided in an embodiment of the present application;
[0046] Figure 3 A schematic diagram of a blockchain data storage method provided in an embodiment of the present application Figure 1 ;
[0047] Figure 4 A schematic diagram of a blockchain data storage method provided in an embodiment of the present application Figure 2 ;
[0048] Figure 5 A schematic diagram of a blockchain data storage method provided in an embodiment of the present application Figure 3 ;
[0049] Figure 6 A flowchart of the steps of merging and identifying blockchain data provided in an embodiment of the present application;
[0050] Figure 7 A schematic diagram of a blockchain data storage method provided in an embodiment of the present application Figure 4 ;
[0051] Figure 8 A schematic diagram of a blockchain data storage method provided in an embodiment of the present application Figure 5 ;
[0052] Fig. 9 A schematic diagram of the architecture of a blockchain data storage system provided in an embodiment of the present application;
[0053] Fig.10 A schematic diagram of the structure of a blockchain data storage device provided in an embodiment of the present application;
[0054] Fig.11 A schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0056] The data in the blockchain generally meets two characteristics: traceability and verifiability. Traceability means that the current data of the blockchain can be derived from scratch, that is, the blockchain saves the previous data and will not be deleted because it is outdated (that is, when a piece of data is modified, the data before the modification will still be saved and will not be deleted); verifiability means that the correctness of all the data in the blockchain can be verified in some way. Before the user needs to operate the blockchain data, the current data is generally verified to ensure that the data obtained when operating the blockchain data is correct, that is, before writing the data, the user needs to read the corresponding old data to verify the correctness of the data.
[0057] Currently, blockchain mainly uses KV databases with LSM tree as the data structure to save data. For example, the underlying databases used by mainstream blockchains such as HyperLedger Fabric and Ethereum for data storage are all key-value databases with LSM tree storage structure as the core.
[0058] Figure 1 A schematic diagram of an LSM tree storage structure provided in an embodiment of the present application, such as Figure 1 As shown in Figure 1, the LSM tree consists of multiple levels, from the memory level to the Level 0 and Level 1 levels on the disk. Data is first written to the MemTable in the memory. When the MemTable is full of data, the data is stored in the Immutable MemTable, and finally all the data is refreshed to the disk to form an SSTable (such as Figure 1 When reading data, the data in memory is read first. If the data cannot be found in memory, the disk will search for the corresponding SSTable layer by layer, and finally the data is found.
[0059] In the LSM tree, the data inside the SSTable is sorted by key. The key ranges of the data in all SSTables of the same level will not overlap (for example, in the same level, the key ranges of two SStables cannot be [1,10] and [5,20] because the ranges overlap. The key ranges of two SStables can be [1,10] and [15,25] because the ranges do not overlap). When a level stores a certain number of SSTables, the level will select some SSTables and merge them with the SSTables of the next level using the merge sort algorithm (compaction), reorganize them into multiple SSTables, and store them in the next level.
[0060] Currently, blockchain data is increasing. When accessing and modifying new data, old data will inevitably be read. If old data is extracted every time it is identified, an additional disk read and write operation will be performed each time it is extracted, which will bring additional read and write overhead and lead to lower read and write efficiency.
[0061] In addition, the untimely release of old data will cause the storage space to increase: old data will continue to increase during the continuous execution of transactions, resulting in an increasingly serious mixture of new and old data in the LSM tree. Therefore, it should be released to other storage spaces and should not be stored together with new data.
[0062] Based on this, in order to solve the above problems, the present application provides a blockchain data storage method, device and computer equipment. By setting the current data storage structure and the historical data storage structure, the current data and the historical data can be stored separately, that is, the new and old data can be analyzed, and the additional reading of old data when accessing new data can be reduced, which is conducive to improving the reading and writing efficiency of blockchain data.
[0063] When modifying historical data, the present application can determine whether the historical data is stored in the temporary storage area of the current data storage structure. If so, the historical data can be directly stored in the historical data storage structure; if not, the data identifier of the historical data can be recorded, and the historical data can be extracted from the permanent storage area of the current data storage structure based on the data identifier and stored in the historical data storage structure. At the same time, the modified current data is stored in the current data storage structure, thereby achieving separation of new and old data. In this way, the blockchain data storage method provided by the present application can avoid the need to read old data when accessing new data, thereby improving the reading and writing efficiency of blockchain data.
[0064] Figure 2 A schematic diagram of an application function environment of a blockchain data storage method provided in an embodiment of the present application; the blockchain data storage method provided in an embodiment of the present application can be applied to Figure 2 In the application environment shown. The pre-established data storage system 201 can store the data that the server 202 needs to process. The data storage system can be integrated on the server 202, or it can be placed on the cloud or other network servers. Among them, the server 202 can communicate with the terminal 203. The terminal 203 can be, but is not limited to, various computers, laptops, smart phones, tablet computers, etc. The server 202 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.
[0065] In an exemplary embodiment, Figure 3 A schematic diagram of a blockchain data storage method provided in an embodiment of the present application Figure 1 ,like Figure 3 As shown, a blockchain data storage method is provided, which is applied to Figure 2 In the application scenario shown, the data storage system may include a current data storage structure and a historical data storage structure; the data storage structures include a temporary storage area and a permanent storage area. This embodiment uses the method applied to a server as an example for illustration. It is understandable that the method may also be executed by a terminal as an execution subject, or by a system including a terminal and a server as a main body, and implemented through the interaction between the terminal and the server. The method includes the following S301 to S304. Among them:
[0066] S301. When modifying historical data stored in a current data storage structure, determine the storage location of the historical data, and store the current data obtained by modifying the historical data into the current data storage structure.
[0067] The current data storage structure and the historical data storage structure may be the same data storage structure, for example, both may be databases with an LSM tree storage structure as the core. The LSM tree structure may include memory storage and disk storage.
[0068] Among them, the current data storage structure can be a data storage structure for storing new data, and the current data storage structure can also store unidentified old data. Historical data can refer to data that needs to be modified, that is, after a certain blockchain data is modified, the blockchain data becomes historical data, and the modified blockchain data is new data. The storage location of historical data can refer to the location where the historical data is stored in the current data storage structure. The current data storage refers to new data, that is, the modified blockchain data. It can be understood that due to the traceability of the blockchain, both the data before and after the modification of the blockchain will be stored, and the old data will be saved and will not be deleted. Therefore, the historical data can be the blockchain data before the current data is modified, that is, the current data can be obtained after the historical data is modified.
[0069] For example, the server can determine whether, when writing blockchain data, the historical data already stored in the current data storage structure is modified. If the historical data is not modified, that is, the current data is new input data, then the new input data can be directly written into the current data storage structure.
[0070] For example, when the current data storage structure is an LSM tree structure, if new data is written to the current data storage structure and the new data does not need to be modified, the new data can be written in the same way as the original LSM tree.
[0071] When the server determines that the historical data stored in the current data storage structure is modified when writing data, it can determine the storage location of the historical data to be modified. For example, the server can determine whether the historical data is stored in the temporary storage area of the current data storage structure or in the permanent storage area of the current data storage structure.
[0072] The server may obtain current data based on the modification of historical data, and store the current data as new data in the current data storage structure. For example, the current data may be first stored in a temporary storage area of the current data storage structure.
[0073] As an example, the temporary storage area of the current data storage structure is a memory area of the LSM tree structure.
[0074] In this way, through step S301, it is possible to identify the historical data corresponding to the current data and store the current data.
[0075] S302: If the storage location is a temporary storage area of the current data storage structure, the historical data in the temporary storage area is stored in the historical data storage structure.
[0076] S303: If the storage location is a permanent storage area of the current data storage structure, determine a data identifier corresponding to the historical data.
[0077] The temporary storage area may refer to memory storage. The permanent storage area may refer to disk storage. The data identifier may be the key of historical data. For example, in the LSM structure, blockchain data may be stored in the form of key-value, where the key may be used as the data identifier and the value may be used as the historical data.
[0078] For example, if the storage location of historical data is a temporary storage area of the current data storage structure, the historical data can be directly stored in the historical data storage structure. Since the temporary storage area is used to temporarily store data, it can be directly extracted and transferred. In this way, the historical data can be effectively transferred to the historical data storage structure, and the separation of new and old data is achieved. When accessing new data, the old data will not be read additionally.
[0079] If the historical data storage location is a permanent storage area of the current data storage structure, the server can first record the historical data, that is, it can determine the data identifier corresponding to the historical data, and can identify and record the representation of the historical data. Further, the historical data stored in the permanent storage area can be extracted and transferred through the data identifier. Since the data stored in the permanent storage area cannot be transferred directly, the data identifier of the historical data can be effectively recorded through step S303, which is beneficial to the subsequent extraction and transfer of the historical data, thereby facilitating the separation of new and old data, and no additional old data will be read when accessing new data.
[0080] S304: Storing the historical data extracted from the permanent storage area based on the data identifier into the historical data storage structure.
[0081] Exemplarily, the server may extract historical data corresponding to the data identifier from the permanent storage area through the data identifier, and may store the historical data in the storage structure.
[0082] Optionally, the historical data storage structure is an LSM tree structure, and the operation of historical data storage can be consistent with the original LSM tree, that is, the data is first written to the MemTable in the memory of the LSM tree. When the MemTable is full of data, the data in it will be stored in the Immutable MemTable, and finally all the data will be refreshed to the disk to form an SSTable, such as Figure 1 As shown in the figure, data persistence is achieved. When reading data, the data in the memory is read first. If the data cannot be found in the memory, the disk will be searched layer by layer for the corresponding SSTable, and the data will be finally found.
[0083] Optionally, the historical data storage structure can be stored locally or remotely.
[0084] In this embodiment, by providing a current data storage structure and a historical data storage structure, the current data and the historical data can be stored separately, that is, the new and old data can be analyzed to reduce the additional reading of the old data when accessing the new data, which is beneficial to improving the read and write efficiency of the blockchain data. The method provided by the present application can determine whether the historical data stored in the current data storage structure is stored in the temporary storage area of the current data storage structure when the historical data needs to be modified. If so, the historical data can be directly stored in the historical data storage structure; if not, the data identifier of the historical data can be recorded, and the historical data can be extracted from the permanent storage area of the current data storage structure based on the data identifier, and stored in the historical data storage structure. At the same time, by storing the modified current data in the current data storage structure, the separation of the new and old data can be achieved, that is, the new and old data are stored separately, reducing the need to read the old data when accessing the new data, avoiding additional data reading, and thus improving the read and write efficiency of the blockchain data.
[0085] In an exemplary embodiment, Figure 4 A schematic diagram of a blockchain data storage method provided in an embodiment of the present application Figure 2 ,like Figure 4 As shown, in Figure 3 On the basis of the above, the steps of the blockchain data storage method are further described, wherein the data storage system further includes identifying the data storage structure; in the step of S304, the historical data extracted from the permanent storage area based on the data identification is stored in the historical data storage structure, including S401 to S403, wherein:
[0086] S401. Store the data identifier corresponding to the historical data into an identification data storage structure.
[0087] S402: Determine, from the permanent storage area of the current data storage structure, a target data identifier that matches the data identifier stored in the identification data storage structure.
[0088] S403: extract historical data corresponding to the target data identifier, and store the historical data into a historical data storage structure.
[0089] The identification data storage structure may refer to a storage structure for storing old data that needs to be identified, so that the old data that needs to be transferred and stored can be extracted from the permanent storage area of the current data storage structure through the identification data storage structure. The target data identifier may refer to a data identifier that exists in both the current data storage structure and the identification data storage structure, that is, a data identifier corresponding to the historical data that needs to be extracted from the current data storage structure.
[0090] Exemplarily, when the storage location of historical data is the permanent storage area of the current data storage structure, the server can determine the data identifier of the historical data and write its data identifier into the identification data storage structure. For example, when the identification data storage structure is an LSM tree structure, the key of the historical data can be written into the Memtable of the identification data storage structure, so that the old data that needs to be extracted from the current data storage structure can be recorded through the identification data storage structure, and the modified current data (new data) can be written into the current data storage structure.
[0091] Furthermore, the server can determine whether there is a data identifier identical to the data identifier stored in the identification data storage structure in the permanent storage area of the current data storage structure. If so, the data identifier can be used as the target data identifier, and the historical data corresponding to the target data identifier can be transferred and stored in the historical data storage structure. In this way, the historical data in the permanent storage area of the current data storage structure can be effectively identified and transferred for storage, so that new data and old data can be separated.
[0092] Optionally, a target data identifier that matches the data identifier stored in the identification data storage structure can be determined at any time from the permanent storage area of the current data storage structure, and historical data corresponding to the target data identifier can be extracted at a preset time and stored in the historical data storage structure, thereby completing the identification and extraction of the data.
[0093] Optionally, when the current data storage structure and the identified data storage structure are both LSM tree structures, when the amount of data stored in one storage level in the permanent storage area of the current data storage structure is too large, the storage data of the storage level can be merged with the storage data of the next level. At the same time, the data of the corresponding level in the data storage structure can also be identified and merged. During the data merging operation, the data identifier can be identified and judged to determine the target data identifier in the permanent storage area of the current data storage structure, so that the stored target data identifier can be effectively judged, and data identification can be realized in the hierarchical data merging process, which can reduce the number of times blockchain data is read and written, thereby improving data reading and writing efficiency, and further improving transaction execution efficiency.
[0094] In this embodiment, by storing the data identifier corresponding to the historical data into the identification data storage structure, and by determining the target data identifier that matches the data identifier stored in the identification data storage structure from the permanent storage area of the current data storage structure, the historical data corresponding to the target data identifier can be extracted, and the historical data can be stored in the historical data storage structure, thereby effectively separating the new data from the old data, thereby improving the reading and writing efficiency of the blockchain data.
[0095] In an exemplary embodiment, Figure 5 A schematic diagram of a blockchain data storage method provided in an embodiment of the present application Figure 3 ,like Figure 5 As shown, in Figure 3 and Figure 4 On the basis of, the blockchain data storage method is further described, wherein the temporary storage area includes a changeable storage unit, and the permanent storage area includes multiple storage levels of progressive storage; in step S402, determining a target data identifier that matches a data identifier stored in the identification data storage structure from the permanent storage area of the current data storage structure includes:
[0096] S501, when the storage layer of the current data storage structure overflows the storage data, obtaining the first data identifier of the current layer of the data overflow and the first data identifier of the next layer in the current data storage structure;
[0097] S502, obtaining a second data identifier of a current level corresponding to a data overflow level in an identification data storage structure, and a second data identifier of a next level; wherein the next level is a level that is stored progressively next to the current level;
[0098] S503: Determine, from the first data identifier, a target data identifier that matches the second data identifier.
[0099] The first data identifier may refer to a data identifier stored in the current data storage structure, and the first data identifier includes a data identifier of a current level of the current data storage structure and a data identifier of a level below the current level.
[0100] The second data identifier may refer to a data identifier stored in the data storage structure, and the second data identifier includes a data identifier for identifying a level of corresponding data overflow in the data storage structure and a data identifier of a level below the corresponding level.
[0101] Exemplarily, if there is too much data at a certain level in the permanent storage area of the current data storage structure, the level can be merged with the next level. For example, when the current data storage structure is an LSM tree structure, if the amount of data at a certain level in the SSTable stored on the disk is greater than the preset quantity threshold of the level, the data at the level in the SSTable can be merged with the data at the next level. During the data merging process, old data (historical data) can be identified and extracted, that is, the server can determine the data identifier of the current level of data overflow and the data identifier of the next level of the current level of data overflow in the current data storage structure, and the above data identifier can be used as the first data identifier.
[0102] At the same time, the server can also synchronously determine the data identifier of the current level corresponding to the data overflow in the current data storage structure and the data identifier of the next level in the identification data storage structure, and can use the data identifier in the above identification data storage structure as the second data identifier.
[0103] Furthermore, the server can find the data identifier that is the same as the second data identifier from the first data identifier, and use it as the target data identifier, and can transfer and store the historical data corresponding to the target data identifier into the historical data storage structure. It can be understood that the permanent storage area of the identification data storage structure can perform data merging operations without being full of data, and the merging operation is mainly performed based on the data overflow of the permanent storage area of the current data storage structure. In this way, it is conducive to synchronous data merging operations, that is, it is conducive to the identification and extraction of historical data.
[0104] In this embodiment, when there is too much data at a certain level in the permanent storage area of the current data storage structure, historical data can be identified and extracted during the data merging process. In this way, during the merging process, the disk reading and writing process required for multiple extractions of old data can be avoided. Only one disk reading and writing is required to complete the extraction of a large amount of old data, thereby further improving the reading and writing efficiency of blockchain data.
[0105] In some specific embodiments, when the current data storage structure and the identification data storage structure are both LSM tree structures, if the number of SSTables at a certain level of the current data storage structure is too large, some of the SSTables will be merged (compaction) with the next level. At the same time, the two adjacent levels corresponding to the identification data storage structure will also be merged with the current data storage structure to identify old data.
[0106] Specifically, SSTable is ordered, so multiple SSTables can be merged and reorganized into multiple ordered SSTables with non-overlapping key ranges. During the merging algorithm process of multiple SSTables that need to be merged in the current data storage structure, the merging algorithm process will also be performed together with the SSTables in the identification data storage structure. During the merging algorithm process, if the key of the data in the current data storage structure is the same as the key of the data in the identification data storage structure, then the data is identified as old data, the data is extracted and stored in the old data storage layer, and the corresponding data in the identification data storage structure will be directly deleted.
[0107] After the merge is completed, the data in the current data storage structure will be reorganized into multiple SSTables and stored in the next level of the current data storage structure. Similarly, the data in the identification data storage structure will be reorganized into multiple SSTables and stored in the next level of the identification data storage structure. At this point, the merge operation process is completed, and the separation of new and old data is completed.
[0108] Figure 6 A flowchart of the blockchain data merging and identification steps provided in the embodiment of the present application is as follows: Figure 6 As shown, in Figure 5 Based on this, a detailed example is given to illustrate the blockchain data storage method, including:
[0109] Since the merging process only involves the comparison between the keys of the data, this example omits the specific values of the data. i The level L stores an SSTable (the key of the data stored in level L1 is (25, 30, 42)). i+1 Two SSTables are stored in the level (the key of the data stored in level 1 is (10, 27); the key of the data stored in level 1 is (33, 45)), where the data with keys 30 and 45 are old data; the level B in the recognition layer iThe level B stores an SSTable (the key of the data stored in b1 is (23, 30, 40)). i+1 Two SSTables are stored in each level (the key of the data stored in b2 is (20, 32); the key of the data stored in b3 is (35, 45)).
[0110] During the merging process, the data in all SSTables (l1, l2, l3, b1, b2, b3) are merged. During the merging process, it is first discovered that the data with key 30 in l1 is equal to the data with key 30 in b1. Therefore, the data with key 30 in l1 is identified as old data and is extracted, while the data with key 30 in b1 is directly deleted.
[0111] Then it is found that the data with key 45 in l3 is equal to the data with key 45 in b3, so the data with key 45 in l3 is identified as old data and is extracted, while the data with key 45 in b3 is directly deleted.
[0112] The remaining five data with keys (10, 25, 27, 33, 42) in the new data storage layer will be reorganized into two SSTables (the key of the data stored in l1′ is (10, 25, 27), and the key of the data stored in l2′ is (33, 42)) and stored in the Lth SSTable of the new data storage layer. i+1 level.
[0113] The remaining five data with keys (20, 23, 32, 35, 40) in the recognition layer will be reorganized into two SSTables (the key of the data stored in b1′ is (20, 23, 32), and the key of the data stored in b2′ is (35, 40)) and stored in the Bth column of the recognition layer. i+1 level.
[0114] The two data with keys 30 and 45 extracted will be directly stored in the old data storage layer.
[0115] In this way, the merging process can avoid the disk reading and writing process required for multiple extractions of old data, and only one disk reading and writing process is required to complete the extraction of a large amount of old data.
[0116] In an exemplary embodiment, the method further comprises:
[0117] Determine a target hierarchical ordering of a current hierarchical level for data overflow in a permanent storage area of a current data storage structure;
[0118] A level in the permanent storage area of the data storage structure having the same order as the target level is identified as the current level corresponding to the data overflow level.
[0119] In an exemplary embodiment, Figure 7 A schematic diagram of a blockchain data storage method provided in an embodiment of the present application Figure 4 ;like Figure 7 As shown, in Figure 3 and Figure 4 On the basis of the above, the steps of the blockchain data storage method are further described. In step S401, the data identifier corresponding to the historical data is stored in the identification data storage structure, including:
[0120] S701, storing the data identifier corresponding to the historical data in a temporary storage area for identifying the data storage structure;
[0121] S702: When the temporary storage area of the current data storage structure overflows with stored data, the identification data of the temporary storage area of the identification data storage structure is stored in the permanent storage area of the identification data storage structure.
[0122] When the identification data storage structure is an LSM tree, the temporary storage area for the identification data storage structure may be a memory storage.
[0123] Exemplarily, when the storage location of the historical data is the permanent storage area of the current data storage structure, the server can determine the data identifier corresponding to the historical data, and store the data identifier corresponding to the historical data in the temporary storage area of the identification data storage structure. Furthermore, the server can store the modified current data in the temporary storage area of the current data storage structure.
[0124] If the temporary storage area of the current data storage structure overflows with stored data, for example, when the amount of data in the memory of the LSM tree is too much (full of data), the current data in the temporary storage area of the current data storage structure can be stored in the permanent storage area of the current data storage structure. At the same time, the identification data in the temporary storage area of the other data storage structure can be stored in the permanent storage area of the identification data storage structure. At this time, the temporary storage area of the identification data storage structure may not be full of data, that is, when the current data in the temporary storage area of the current data storage structure is stored in the permanent storage area of the current data storage structure, the identification data in the temporary storage area of the identification data storage structure is synchronously stored in the permanent storage area of the identification data storage structure. In this way, the current data storage structure and the identification data storage structure can be synchronously stored, which is beneficial to the subsequent identification and extraction of old historical data, thereby facilitating the separation of new and old data.
[0125] Optionally, the temporary storage area includes modifiable storage units and unmodifiable storage units. If the modifiable storage units of the current data storage structure are full of data, the current data storage structure will store the data therein into the unmodifiable storage units of the current data storage structure, and eventually refresh all of the data to the permanent storage area of the current data storage structure; at the same time, the modifiable storage units of the identification data storage structure will also store the data therein into the unmodifiable storage units of the identification data storage structure, and eventually refresh all of the data to the permanent storage of the identification data storage structure to form an SSTable (the modifiable storage units of the identification data storage structure may not be full of data).
[0126] For example, the modifiable storage unit may be a Memtable in the memory of the LSM tree, and the unmodifiable storage unit may be an Immutable MemTable in the memory of the LSM tree.
[0127] That is, the Memtable of the current data storage structure is full of data, and the current data storage structure stores the data in it into the Immutable MemTable of the current data storage structure, and finally refreshes all of this data to the disk of the current data storage structure at Level 0 to form an SSTable. At the same time, the Memtable of the identification data storage structure will also store the data in it into the Immutable MemTable of the identification data storage structure, and finally refreshes all of this data to the disk of the identification data storage structure at Level 0 to form an SSTable (the Memtable of the identification data storage structure may not be full of data).
[0128] In this embodiment, when the data stored in the temporary storage area of the current data storage structure overflows, the identification data of the temporary storage area of the identification data storage structure is stored in the permanent storage area of the identification data storage structure, and the data in the temporary storage area of the current data storage structure can be synchronously stored in the permanent storage area, which is beneficial to the identification and extraction of historical data, and can realize the separate storage of new and old data, thereby improving the reading and writing efficiency of blockchain data.
[0129] In an exemplary embodiment, the identification data storage structure is used to store data identifiers, and is not used to store historical data corresponding to the data identifiers. In this way, the old data stored in the identification data storage structure does not need to store specific values, but only needs to store the corresponding key, and the value is empty, thereby reducing the cost of data storage.
[0130] In an exemplary embodiment, Figure 8 A schematic diagram of a blockchain data storage method provided in an embodiment of the present application Figure 5,like Figure 8 As shown, in Figure 3 On the basis of the above, the steps of the blockchain data storage method are further described. In the step S301, the storage location of the historical data is determined, including S801 to S803, wherein:
[0131] S801, obtaining the storage status of historical data in the temporary storage area of the current data storage structure;
[0132] S802: If the storage status indicates that historical data exists in the temporary storage area, the storage location is the temporary storage area of the current data storage structure;
[0133] S803: If the storage status indicates that historical data exists in the temporary storage area, the storage location is the permanent storage area of the current data storage structure.
[0134] The storage status may be used to indicate whether there is historical data in the temporary storage area.
[0135] Exemplarily, the server can determine whether historical data is found in the memory of the current data storage structure. If it can be found, it means that the storage location of the historical data is a temporary storage area of the current data storage structure, and the historical data can be directly transferred and stored in the historical data storage structure. If it cannot be found, it means that the storage location of the historical data is a permanent storage area of the current data storage structure, and it cannot be directly transferred and stored.
[0136] For example, if the current data storage structure needs to modify historical data, it will first search for historical data in the memory of the current data storage structure. If historical data is found in the memory of the current data storage structure, the historical data will be transferred to the old data storage layer (the historical data has become old data), and the modified current data (new data) will be written to the Memtable of the current data storage structure.
[0137] If the current data cannot be found in the memory of the current data storage structure (that is, the historical data is in the disk of the current data storage structure), then the key of the historical data is written into the Memtable of the identification data storage structure, so that the identification data storage structure records the old data (historical data) that needs to be extracted from the current data storage structure, and the modified current data (new data) is written into the memory of the current data storage structure.
[0138] In this embodiment, through the above steps S801 to S803, it is possible to determine whether the corresponding historical data exists in the temporary storage area. If not, it means that the data is in the permanent storage area, and there is no need to read the data in the permanent storage area, which is beneficial to improving the reading efficiency of blockchain data.
[0139] In an exemplary embodiment, the blockchain data storage method further includes the following steps:
[0140] In response to a modification instruction for historical data stored in the current data storage structure, a read verification result of reading and verifying the historical data is obtained.
[0141] If the read verification result indicates that the read verification is passed, the current data obtained by modifying the historical data will be obtained, and the data identifier of the historical data will be determined.
[0142] For example, if the historical data stored in the current data storage structure is to be modified, the server can respond to the modification instruction. At this time, it is necessary to first read the historical data stored in the current data storage structure. When reading the historical data, the historical data needs to be verified. Only if the verification is correct can the modification be made.
[0143] Optionally, through the verifiability of the block, before writing the modified new data, the user needs to read the corresponding historical data to verify its correctness. The read verification result indicates that the modified new data can be written only after the read verification is passed, and the data identifier (for example, key) of the historical data can be directly obtained.
[0144] In this embodiment, by performing read verification on the historical data, if the read verification result indicates that the read verification is passed, the current data obtained by modifying the historical data will be obtained, and the data identifier of the historical data will be determined. In this way, the security of writing and reading blockchain data can be guaranteed, and the data identifier of the historical data can be obtained, which is beneficial to the subsequent extraction of historical data, thereby improving the reading and writing efficiency of blockchain data.
[0145] In some specific embodiments, Fig. 9 A schematic diagram of the architecture of a blockchain data storage system provided in an embodiment of the present application; Fig. 9 As shown, the blockchain data storage method can be applied to a data storage system, which is a key-value database based on LSM trees. Its structure is divided into three logical parts: current data storage structure, historical data storage structure, and identification data storage structure. The data in the three logical parts are all composed of the LSM tree architecture (that is, the underlying database is composed of three LSM trees). Among them:
[0146] The current data storage structure 910 , the historical data storage structure 920 , and the identification data storage structure 930 all include a temporary storage area 904 and a permanent storage area 905 .
[0147] The temporary storage area includes a modifiable storage unit 904 a (memtable) and an immutable storage unit 904 b (Immutable MemTable).
[0148] The permanent storage area includes multiple storage levels 905a (Level 0, Level 1, ..., Level n ).
[0149] Exemplarily, the current data storage structure mainly stores new data in the blockchain, but since some old data may still not be identified, there may also be old data.
[0150] The historical data storage structure mainly stores old data in the blockchain. The old data will be identified and transferred in the current data storage structure by identifying the data storage structure.
[0151] The identification layer is used to store old data that needs to be identified. The old data stored in it does not need to store specific values, but only needs to store the corresponding key, while the value is empty, thereby reducing the cost of data storage.
[0152] Optionally, the merging operation of the historical data storage structure may be performed in parallel with the merging operation of the current data storage structure and the identification data storage structure, because the two merging operations do not conflict with each other.
[0153] In actual applications, the blockchain data storage system provides four user interfaces:
[0154] Put (key, value): The function is to write new data. The process is to write the data with key as key and value as value into the current data storage structure. It does not need to be written into the identification data storage structure and the historical data storage structure.
[0155] Get (key): The function is to read new data. The process is to read the data with the key key in the current data storage structure, without having to read from the identification data storage structure and the historical data storage structure.
[0156] Ancient_Put (key, value, old_key): The function is to write new data and identify old data, and write the data with key as key and value as value to the current data storage structure. At the same time, search for the data with key as old_key in the memory of the current data storage structure. If the search is successful, the data with key as old_key is written to the historical data storage structure, and the data is deleted from the current data storage structure; if the search fails, the data with key as old_key is written to the identification data storage structure.
[0157] Ancient_Get (old_key): The function is to read old data. The process is to read the data with the key old_key in the current data storage structure and the historical data storage structure. Because some old data may not be recognized, it is also necessary to search for old data in the current data storage structure.
[0158] In this embodiment, the blockchain data storage method provided in the above-mentioned embodiments of the present application can be implemented through the data storage system of the above-mentioned blockchain. In this way, the present application takes into account the underlying database affected by the mixed storage of new and old data of the blockchain, and can store new and old data separately; and based on the current LSM tree, provides a blockchain data storage method that can separate new and old data of the blockchain (extracting old data during the merging process), thereby improving the reading and writing efficiency of blockchain data, and then improving the transaction execution efficiency.
[0159] In this embodiment, under the influence of the mixed storage of new and old data in the blockchain, the new and old data can be effectively separated, and the number of disk I / O times when reading and writing blockchain data can be reduced, thereby improving data reading and writing efficiency, and then improving transaction execution efficiency; and the old data can be released to the historical data storage structure, expanding the space for storing new data in the blockchain, so that the blockchain can read new data faster.
[0160] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0161] The blockchain data storage device provided in the embodiments of the present application is described below. The blockchain data storage device has the same inventive concept as the above-mentioned blockchain data storage method. The implementation solution for solving the problem provided by the device is similar to the implementation solution recorded in the above-mentioned method. Therefore, the specific limitations in one or more blockchain data storage device embodiments provided below can refer to the limitations on the blockchain data storage method above. The blockchain data storage device described below and the blockchain data storage method described above can be referred to each other, and will not be repeated here.
[0162] In an exemplary embodiment, Fig.10A schematic diagram of the structure of a blockchain data storage device provided in an embodiment of the present application is shown in FIG. Fig.10 As shown, it is applied to a pre-established data storage system, the data storage system includes a current data storage structure and a historical data storage structure; the data storage structure includes a temporary storage area and a permanent storage area; the blockchain data storage device 100 includes: a storage location determination module 1010, a direct storage module 1020, an identification determination module 1030, and an extraction storage module 1040, wherein:
[0163] The storage location determination module 1010 is used to determine the storage location of the historical data when the historical data stored in the current data storage structure is modified, and store the current data obtained by modifying the historical data into the current data storage structure.
[0164] The direct storage module 1020 is used to store the historical data in the temporary storage area into the historical data storage structure if the storage location is a temporary storage area of the current data storage structure.
[0165] The identifier determination module 1030 is used to determine the data identifier corresponding to the historical data if the storage location is a permanent storage area of the current data storage structure.
[0166] The extraction storage module 1040 is used to store the historical data extracted from the permanent storage area based on the data identifier into the historical data storage structure.
[0167] In an exemplary embodiment, the data storage system also includes an identification data storage structure; an extraction storage module is used to store data identifiers corresponding to historical data into the identification data storage structure; a target data identifier that matches the data identifier stored in the identification data storage structure is determined from a permanent storage area of the current data storage structure; historical data corresponding to the target data identifier is extracted, and the historical data is stored in the historical data storage structure.
[0168] In an exemplary embodiment, the temporary storage area includes a changeable storage unit, and the permanent storage area includes multiple storage levels of progressive storage. The extraction storage module is used to obtain the first data identifier of the current level of data overflow and the first data identifier of the next level in the current data storage structure when the storage level of the current data storage structure overflows; obtain the second data identifier of the current level corresponding to the data overflow level in the identification data storage structure, and the second data identifier of the next level; wherein the next level is the next progressively stored level of the current level; and determine the target data identifier that matches the second data identifier from the first data identifier.
[0169] In an exemplary embodiment, the extraction storage module is also used to determine the target level order of the current level of data overflow in the permanent storage area of the current data storage structure; and identify the level in the permanent storage area of the data storage structure that is the same as the target level order as the current level corresponding to the data overflow level.
[0170] In an exemplary embodiment, the extraction and storage module is used to store the data identifier corresponding to the historical data into a temporary storage area of the identification data storage structure; when the storage data in the temporary storage area of the current data storage structure overflows, the identification data in the temporary storage area of the identification data storage structure is stored in the permanent storage area of the identification data storage structure.
[0171] In an exemplary embodiment, the identification data storage structure is used to store the data identifier, and is not used to store the historical data corresponding to the data identifier.
[0172] In an exemplary embodiment, a storage location determination module is used to obtain the storage status of historical data in a temporary storage area of a current data storage structure; if the storage status indicates that historical data exists in the temporary storage area, the storage location is the temporary storage area of the current data storage structure; if the storage status indicates that historical data exists in the temporary storage area, the storage location is the permanent storage area of the current data storage structure.
[0173] In an exemplary embodiment, the device further includes a read-write verification module.
[0174] The read-write verification module is used to respond to modification instructions for historical data stored in the current data storage structure, and obtain a read verification result for reading and verifying the historical data; if the read verification result indicates that the read verification is passed, the current data obtained by modifying the historical data will be obtained, and the data identifier of the historical data will be determined.
[0175] In an exemplary embodiment, the present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by one or more processors, the one or more processors perform the steps of the blockchain data storage method in any of the above embodiments.
[0176] In an exemplary embodiment, the present application also provides a computer device having a computer program stored therein, wherein when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the blockchain data storage method in any one of the above embodiments.
[0177] In an exemplary embodiment, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the blockchain data storage method in any of the above embodiments.
[0178] Indicatively, Fig.11 As shown, Fig.11 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. The computer device 110 may be provided as a server. Fig.11 The computer device 110 includes a processing component 1102, which further includes one or more processors, and a memory resource represented by a memory 1101 for storing instructions executable by the processing component 1102, such as an application. The application stored in the memory 1101 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1102 is configured to execute instructions to perform the text recognition method of any of the above embodiments.
[0179] The computer device 1100 may further include a power supply component 1103 configured to perform power management of the computer device 1100, a wired or wireless network interface 1104 configured to connect the computer device 1100 to a network, and an input / output (I / O) interface 1105. The computer device 1100 may operate based on an operating system stored in the memory 1101, such as Windows Server TM, Mac OS X TM, Unix TM, Linux TM, Free BSD TM, or the like.
[0180] Those skilled in the art will understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0181] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0182] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0183] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can refer to each other.
[0184] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A blockchain data storage method, characterized in that: Applied to a pre-established data storage system, the data storage system includes a current data storage structure and a historical data storage structure; the data storage structures each include a temporary storage area and a permanent storage area; the method includes: In the case of modifying the historical data stored in the current data storage structure, determining the storage location of the historical data, and storing the current data obtained by modifying the historical data in the current data storage structure; If the storage location is a temporary storage area of the current data storage structure, storing the historical data in the temporary storage area into the historical data storage structure; If the storage location is a permanent storage area of the current data storage structure, determining a data identifier corresponding to the historical data; The historical data extracted from the permanent storage area based on the data identifier is stored in the historical data storage structure.
2. The method according to claim 1, characterized in that The data storage system also includes identifying a data storage structure; The storing the historical data extracted from the permanent storage area based on the data identifier into the historical data storage structure includes: Storing the data identifier corresponding to the historical data in the identification data storage structure; Determining, from a permanent storage area of the current data storage structure, a target data identifier that matches a data identifier stored in the identification data storage structure; The historical data corresponding to the target data identifier is extracted, and the historical data is stored in the historical data storage structure.
3. The method according to claim 2, characterized in that The temporary storage area includes a modifiable storage unit, and the permanent storage area includes a plurality of storage levels of progressive storage; The step of determining, from the permanent storage area of the current data storage structure, a target data identifier that matches the data identifier stored in the identification data storage structure comprises: In the case where the storage level of the current data storage structure overflows, obtaining a first data identifier of a current level of the data overflow and a first data identifier of a next level in the current data storage structure; Acquire a second data identifier of a current level corresponding to a data overflow level and a second data identifier of a next level in the identification data storage structure; wherein the next level is a level that is stored progressively next to the current level; A target data identifier matching the second data identifier is determined from the first data identifier.
4. The method according to claim 3, characterized in that The method further comprises: Determining a target hierarchical ordering of a current hierarchical level of data overflow in a permanent storage area of the current data storage structure; The level in the permanent storage area of the identified data storage structure that is in the same order as the target level is used as the current level corresponding to the data overflow level.
5. The method according to claim 2, characterized in that: The storing of the data identifier corresponding to the historical data into the identification data storage structure comprises: storing the data identifier corresponding to the historical data in a temporary storage area of the identification data storage structure; In the case that the data stored in the temporary storage area of the current data storage structure overflows, the identification data in the temporary storage area of the identification data storage structure is stored in the permanent storage area of the identification data storage structure.
6. According to the method according to any one of claims 2 to 5, the identification data storage structure is used to store data identifiers and is not used to store historical data corresponding to the data identifiers.
7. The method according to claim 1, characterized in that Determining the storage location of the historical data includes: Acquire the storage status of the historical data in the temporary storage area of the current data storage structure; If the storage state indicates that the historical data exists in the temporary storage area, the storage location is the temporary storage area of the current data storage structure; If the storage state indicates that the historical data exists in the temporary storage area, then the storage location is the permanent storage area of the current data storage structure.
8. The method according to claim 1, characterized in that The method further comprises: In response to a modification instruction for the historical data stored in the current data storage structure, obtaining a read verification result of reading and verifying the historical data; If the read verification result indicates that the read verification is passed, the current data obtained by modifying the historical data is obtained, and the data identifier of the historical data is determined.
9. A data storage device, characterized in that: Applied to a pre-established data storage system, the data storage system includes a current data storage structure and a historical data storage structure; the data storage structures each include a temporary storage area and a permanent storage area; the device includes: A storage location determination module, used to determine the storage location of the historical data when the historical data stored in the current data storage structure is modified, and store the current data obtained by modifying the historical data into the current data storage structure; A direct storage module, configured to store the historical data in the temporary storage area to the historical data storage structure if the storage location is a temporary storage area of the current data storage structure; an identification determination module, configured to determine a data identification corresponding to the historical data if the storage location is a permanent storage area of the current data storage structure; The extraction storage module is used to store the historical data extracted from the permanent storage area based on the data identifier into the historical data storage structure.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Real-time data and historical data logical separation and storage processing system
CN108572973A
Blockchain data query method, terminal, and storage medium
WO2024216668A1