CN-121979950-A - Data processing method, device, equipment and readable storage medium
Abstract
The application discloses a data processing method, a device, equipment and a readable storage medium, which are used for acquiring a historical block from a block chain data structure through at least one container node started by a block analysis service of a block chain browser, synchronously storing block data obtained by analyzing the historical block into a search engine database of the block chain browser through the at least one container node, detecting the data integrity of the synchronized block data in the search engine database to obtain a detection result, determining abnormal block data to be repaired according to the detection result, inquiring a target historical block associated with the block data to be repaired in the block chain data structure, and repairing the block data to be repaired based on the target historical block through the at least one container node. Therefore, the method can meet the time-efficiency requirements of analysis and storage of the high-concurrency block data, and automatically repair the block data with failed storage so as to improve the query efficiency and accuracy of the block data.
Inventors
- Lv Pengzhen
Assignees
- 腾讯科技(深圳)有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20241029
Claims (15)
- 1. A method of data processing, comprising: Acquiring a history block from a blockchain data structure through at least one container node started by a blockchain browser blockanalysis service; Synchronously storing the block data analyzed from the history block to a search engine database of the blockchain browser through the at least one container node; Performing data integrity detection on the synchronized block data in the search engine database to obtain a detection result; Determining abnormal block data to be repaired according to the detection result, and inquiring a target historical block associated with the block data to be repaired in the block chain data structure; and repairing the block data to be repaired based on the target history block through the at least one container node.
- 2. The method of claim 1, wherein performing data integrity detection on the synchronized block data in the search engine database to obtain a detection result comprises: When a block detection instruction triggered by a preset condition is detected, selecting initial block data to be detected from the block data synchronized by the search engine database according to the block detection instruction; and based on the initial block data, carrying out data integrity detection on the synchronized block data in the search engine database to obtain a detection result.
- 3. The method according to claim 2, wherein the performing data integrity detection on the synchronized block data in the search engine database based on the start block data to obtain a detection result includes: When the block detection instruction is a detection instruction triggered based on a restarting request of the container node, determining a first normal block range according to the current block generation speed of the block chain data structure and the block synchronization duration of a single historical block; the initial block data is block data synchronously stored to the search engine database according to a history block at the current tail end in the block chain data structure; And sequentially performing traversal detection on the data integrity of the synchronized block data in the search engine database by taking the initial block data as a starting point until the number of normal block data of the first normal block range is continuously detected, so as to obtain a detection result.
- 4. The method according to claim 2, wherein the performing data integrity detection on the synchronized block data in the search engine database based on the start block data to obtain a detection result includes: when the block detection instruction is a detection instruction triggered based on a preset timing detection task, determining a second normal block range according to the current block generation speed of the block chain data structure and the block synchronization time length of a single historical block; Dividing the synchronized block data in the search engine database into a plurality of block intervals according to the size of the second normal block range, wherein any one block data in each block interval is used as the initial block data; and based on the initial block data in each block interval, performing data integrity detection on the block data in each block interval to obtain a detection result.
- 5. The method of claim 4, wherein the performing the data integrity test on the block data in each block interval based on the starting block data in each block interval to obtain the test result comprises: respectively detecting the data integrity of the initial block data in each block interval to obtain a block detection result corresponding to the initial block data in each block interval; when at least one block detection result indicates that the corresponding initial block data is abnormal, determining a block interval to be repaired containing the abnormal initial block data; And for each block interval to be repaired, taking the initial block data as a starting point, and respectively carrying out data integrity detection on the block data positioned in the forward direction and the backward direction of the initial block data in a cross-block interval mode until the normal block data of the number of the second normal block range are continuously detected in the forward direction and the backward direction, so as to obtain a detection result.
- 6. The method of claim 5, wherein the performing data integrity detection on the starting block data in each block interval to obtain a block detection result corresponding to the starting block data in each block interval includes: For initial block data in each block interval, acquiring forward adjacent block data to be selected from the search engine database, and acquiring a hash value to be selected corresponding to the block data to be selected from the block data to be selected; comparing the forward block hash value recorded in the corresponding initial block data with the hash value to be selected to obtain a comparison result; And when the comparison result is that the forward block hash value is inconsistent with the hash value to be selected, determining the block detection result of the starting block data as abnormal.
- 7. The method of claim 6, wherein the method further comprises: When the comparison result is that the forward block hash value is consistent with the hash value to be selected, determining the record number of the historical interaction tasks in the block header corresponding to the initial block data; Acquiring the actual task number of the historical interaction tasks contained in the block body corresponding to the initial block data; and when the recording quantity is inconsistent with the actual task quantity, determining the block detection result of the starting block data as abnormal.
- 8. The method according to any one of claims 1 to 7, wherein the storing, by the at least one container node, the chunk data parsed from the history chunk synchronously to a search engine database of the blockchain browser includes: when at least one container node of the blockchain browser is detected to send a restarting request, determining restarting waiting time according to the current block generating speed of the blockchain data structure and the synchronous speed of the blockchain browser aiming at a historical block; and intercepting restarting of the container node corresponding to the restarting request according to the restarting waiting time length, and synchronously storing block data obtained by analyzing the history block on the basis of the at least one container node to a search engine database of the blockchain browser.
- 9. The method of claim 8, wherein the synchronously storing the block data parsed from the history block to the search engine database of the blockchain browser based on the at least one container node comprises: Analyzing the history blocks acquired respectively according to a plurality of preset analysis indexes based on the block analysis service of the at least one container node to obtain block data; And synchronously storing the block data obtained by respective analysis to a search engine database of the block chain browser through a data synchronization channel in the at least one container node.
- 10. The method of any of claims 1 to 9, wherein the at least one container node started by a blockchain browser's blockparse service, prior to retrieving the history block from the blockchain data structure, the method further comprises: Determining the number of historical blocks waiting for synchronization in a block chain data structure, and determining the current block generation speed of the block chain data structure; Determining the starting number of container nodes according to the historical block number and the current block generation speed; And starting at least one container node supporting the block analysis service of the block chain browser according to the starting quantity of the container nodes.
- 11. The method according to any one of claims 1 to 9, wherein the repairing the block data to be repaired based on the target history block by the at least one container node comprises: re-acquiring the target historical block from the blockchain data structure through a query thread of the at least one container node, and analyzing the target historical block to obtain target block data; And transmitting the target block data to the search engine database through a data restoration channel of the at least one container node so as to update the block data to be restored in the search engine database according to the target block data.
- 12. A data processing apparatus, comprising: The acquisition unit is used for acquiring a history block from the block chain data structure through at least one container node started by the block analysis service of the block chain browser; the storage unit is used for synchronously storing the block data analyzed from the history block to a search engine database of the blockchain browser through the at least one container node; The detection unit is used for detecting the data integrity of the synchronized block data in the search engine database to obtain a detection result; The determining unit is used for determining abnormal block data to be repaired according to the detection result and inquiring a target historical block associated with the block data to be repaired in the block chain data structure; And the repairing unit is used for repairing the block data to be repaired based on the target history block through the at least one container node.
- 13. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the data processing method of any of claims 1 to 11 when executing the computer program.
- 14. A computer readable storage medium storing a plurality of instructions adapted to be loaded by a processor to perform the data processing method of any one of claims 1 to 11.
- 15. A computer program product comprising a computer program or instructions which, when executed by a processor, implements the data processing method of any one of claims 1 to 11.
Description
Data processing method, device, equipment and readable storage medium Technical Field The present application relates to the field of computer technologies, and in particular, to a data processing method, apparatus, device, and readable storage medium. Background The blockchain is a data structure formed by connecting a plurality of blocks by hash values before and after each block, and each block is generated by packing operation data interacted between an object and a blockchain system, so that each block on the blockchain contains corresponding data, such as virtual resource transfer, a certain address, virtual resource quantity and the like. However, the object may use the blockchain browser to directly view the historical blockdata on the blockchain to learn about the corresponding interaction condition, but this way depends on the performance of the blockchain node, and cannot guarantee the query efficiency. The related technology analyzes and stores the block data on the block chain into the search engine database one by one according to the sequence, and then checks the block data from the search engine database in an offline inquiry mode, so that the block data is not required to be inquired from the block chain depending on the performance of the block chain node, and the influence of the performance of the block chain node on the inquiry efficiency is avoided. In the research and practice process of the related technology, the inventor discovers that the related technology can not meet the high concurrent analysis and storage aging requirements of the block data by analyzing and storing the block data on the block chain into a search engine database one by one according to the sequence, blocks the analysis and storage progress of the block data on the block chain, and can not automatically recover the block data with failed analysis and storage in real time, thereby influencing the query efficiency and accuracy of an object on the block data. Disclosure of Invention The application provides a data processing method, a device, equipment and a readable storage medium, which can meet the aging requirement of block data in high concurrency analysis and storage and automatically repair block data with storage failure in real time, ensure that blocks on a block chain are accurately analyzed and stored, and improve the query efficiency and accuracy of the block data. In order to solve the technical problems, the application provides the following technical scheme: The embodiment of the application provides a data processing method, which comprises the following steps: Acquiring a history block from a blockchain data structure through at least one container node started by a blockchain browser blockanalysis service; Synchronously storing the block data analyzed from the history block to a search engine database of the blockchain browser through the at least one container node; Performing data integrity detection on the synchronized block data in the search engine database to obtain a detection result; Determining abnormal block data to be repaired according to the detection result, and inquiring a target historical block associated with the block data to be repaired in the block chain data structure; and repairing the block data to be repaired based on the target history block through the at least one container node. Accordingly, an embodiment of the present application provides a data processing apparatus, including: The acquisition unit is used for acquiring a history block from the block chain data structure through at least one container node started by the block analysis service of the block chain browser; the storage unit is used for synchronously storing the block data analyzed from the history block to a search engine database of the blockchain browser through the at least one container node; The detection unit is used for detecting the data integrity of the synchronized block data in the search engine database to obtain a detection result; The determining unit is used for determining abnormal block data to be repaired according to the detection result and inquiring a target historical block associated with the block data to be repaired in the block chain data structure; And the repairing unit is used for repairing the block data to be repaired based on the target history block through the at least one container node. In some embodiments, the detection unit is further configured to: When a block detection instruction triggered by a preset condition is detected, selecting initial block data to be detected from the block data synchronized by the search engine database according to the block detection instruction; and based on the initial block data, carrying out data integrity detection on the synchronized block data in the search engine database to obtain a detection result. In some embodiments, the detection unit is further configured to: When the block detection instruction is a detection instru