IP Library › Granted Patent US 12,135,683
Granted Patent B2
US 12,135,683 · App. 18/339,854 · Granted Nov 5, 2024

Data archiving method and apparatus, device, and storage medium

Inventors: Haoming Feng (Shenzhen, CN); Haitao Tu (Shenzhen, CN); Libao He (Shenzhen, CN); Qiuping Chen (Shenzhen, CN); Jiabao Chen (Shenzhen, CN); Peng Ren (Shenzhen, CN); Shuiping Zhou (Shenzhen, CN); Yong Zhao (Shenzhen, CN); He Wang (Shenzhen, CN)
Assignee: TENCENT TECHNOLOGY (SHENZHEN) COMPANY LIMITED
G06F16/113G06F16/137G06F16/162
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,135,683
App. No.
18/339,854
Granted
Nov 5, 2024
Kind
B2
Abstract

A data archiving method includes: finding, in local space when an archiving task for a target block header exists, current state trees of block headers, the current state trees including a current state tree that the target block header points to and a current state tree that a first block header before the target block header points to; reconstructing new state trees according to the found current state trees, node reuse information between the current state trees, and target state data corresponding to a second block header after the target block header; and archiving the current state trees stored in the local space to a target archiving server, and deleting the current state trees in the local space after successful archiving.

Claims (91)

1. A data archiving method, applied to a computer device and comprising:

finding, in local space when an archiving task for a target block header exists, current state trees of block headers, the current state trees comprising a current state tree that the target block header points to and a current state tree that a first block header before the target block header points to;

reconstructing new state trees, comprising:

reconstructing, according to the found current state trees and node reuse information between the current state trees, a new state tree that the target block header points to; the new state tree that the target block header points to independently storing state data corresponding to the target block header; and

reconstructing, according to the new state tree that the target block header points to and target state data corresponding to a second block header after the target block header, a new state tree that the second block header points to,

wherein node reuse occurs between one of the new state trees corresponding to a block header and a new state tree that a block header next to the corresponding block header points to; and

archiving the current state trees stored in the local space to a target archiving server, and deleting the current state trees in the local space after successful archiving.

2. The method according to claim 1 , wherein the reconstructing, according to the found current state trees and node reuse information between the current state trees, a new state tree that the target block header points to comprises:

determining at least one reused tree node from the current state trees according to the node reuse information between the current state trees, the reused tree node representing a tree node reused in the current state tree that the target block header points to and a current state tree that any first block header points to;

copying the at least one reused tree node, and copying tree nodes in the current state tree that the target block header points to; and

reconstructing, according to the tree nodes obtained by copying, the new state tree that the target block header points to.

3. The method according to claim 1 , wherein

a quantity of second block headers is M, M being a positive integer, and

the reconstructing, according to the new state tree that the target block header and target state data corresponding to a second block header after the target block header, a new state tree that the second block header points to comprises: performing the following processing for an m th second block header:

generating a new leaf node based on target state data corresponding to the m th second block header, the target state data corresponding to the m th second block header representing at least one piece of state data, different from each piece of state data corresponding to a previous block header of the m th second block header, in a plurality of pieces of state data corresponding to the m th second block header, and m∈[1, M];

storing the target state data corresponding to the m th second block header to the new leaf node; and

reconstructing, according to the new leaf node storing the target state data and a new state tree that the previous block header of the m th second block header points to, wherein at least one leaf node is reused in the new state tree that the m th second block header points to and the new state tree that the previous block header points to, and the previous block header is the target block header when m is 1.

4. The method according to claim 1 , wherein the method further comprises:

obtaining transaction data corresponding to the second block header after the target block header, one piece of transaction data indicating a transaction operation on at least one piece of state data; and

performing a transaction operation indicated by the transaction data corresponding to each second block header sequentially in order of block height from low to high, according to the state data stored in the new state tree that the target block header points to, to obtain the target state data corresponding to each second block header.

5. The method according to claim 1 , wherein the method further comprises:

traversing each second block header after the target block header, and determining a current second block header that is currently traversed; and

copying target state data corresponding to the current second block header from a current state tree that the current second block header points to.

6. The method according to claim 1 , wherein the archiving the current state trees stored in the local space to a target archiving server comprises:

determining a block number of a first block header with a smallest block height in at least one first block header as a starting block number;

determining a block number of a first block header with a largest block height in at least one first block header as an ending block number;

determining the current state trees stored in the local space as the data to be archived, and generating an archiving request according to the data, the starting block number, and the ending block number; and

transmitting the archiving request to the target archiving server, the target archiving server performing a hash operation on the data according to the archiving request to obtain a data hash value, and returning the data hash value after storing the data hash value, the data, the starting block number, and the ending block number.

7. The method according to claim 6 , wherein the method further comprises:

determining, in response to receiving the data hash value transmitted by the target archiving server, that the data is successfully archived; and

recording the data hash value, an archiving timestamp, the starting block number, the ending block number, and a server identifier of the target archiving server to an archiving record in the local space.

8. The method according to claim 7 , wherein the method further comprises:

reading the ending block number from the archiving record in the local space in response to a data query request for a specified block header;

generating, when a block number of the specified block header is less than or equal to the ending block number, a specified data query request according to the data hash value in the archiving record in the local space and the block number of the specified block header;

transmitting the specified data query request to the target archiving server, the target archiving server determining and returning state data corresponding to the specified block header according to the data hash value carried in the specified data query request, and the data hash value indicating the current state tree in the data archived and the block number of the specified block header; and

receiving the state data that is returned by the target archiving server and that corresponds to the specified block header, and outputting the state data corresponding to the specified block header.

9. The method according to claim 8 , wherein the method further comprises:

determining, in the local space when the specified block number of the specified block header is greater than the ending block number, a new state tree that the specified block header points to, and determining a new state tree that a block header before the specified block header points to; and

obtaining state data corresponding to the specified block header according to the determined new state tree, and outputting the obtained state data.

10. The method according to claim 1 , wherein

the computer device communicates with a plurality of archiving servers, and

the method further comprises:

obtaining archiving performance parameters of the plurality of archiving servers, an archiving performance parameter of an archiving server comprising at least one of a remaining data storage capacity, a transmission bandwidth, or a security coefficient, and the security coefficient being used for measuring a probability of data of the archiving server being stolen; and

determining archiving priorities of the plurality of archiving servers according to the archiving performance parameters, and determining an archiving server corresponding to a highest archiving priority as the target archiving server.

11. The method according to claim 10 , wherein

the archiving performance parameter comprises the transmission bandwidth, and

the obtaining archiving performance parameters of the plurality of archiving servers comprises:

transmitting a bandwidth detection request to each archiving server, the bandwidth detection request being used for instructing the archiving server to return target data of a specified data volume; and

receiving the target data returned by each archiving server, and determining a transmission bandwidth of each archiving server based on time consumed by each archiving server to return the target data.

12. The method according to claim 1 , wherein the method further comprises:

determining a current block header in a block header chain when the archiving task for the target block header occurs, the current block header representing a block header that points to a state tree in the local space and that has a smallest block height;

determining a latest block header in the block header chain, the latest block header representing a block header that points to a state tree in the local space and that has a largest block height; and

performing, when a block height of the target block header is greater than that of the current block header and less than that of the latest block header, the operation of finding, in the local space, the current state trees, the first block header being the current block header and each block header between the current block header and the target block header, and the second block header being the latest block header and each block header between the latest block header and the target block header.

13. A data archiving apparatus, comprising: a processor and a non-transitory storage medium, and the processor being configured to obtain one or more instructions stored in the storage medium to perform:

finding, in local space when an archiving task for a target block header exists, current state trees of block headers, the current state trees comprising a current state tree that the target block header points to and a current state tree that a first block header before the target block header points to;

reconstructing new state trees, comprising:

reconstructing, according to the found current state trees and node reuse information between the current state trees, a new state tree that the target block header points to, the new state tree that the target block header points to independently storing state data corresponding to the target block header;

reconstructing, according to the new state tree that the target block header points to and target state data corresponding to a second block header after the target block header, a new state tree that the second block header points to,

wherein node reuse occurs between one of the new state trees corresponding to a block header and a new state tree that a block header next to the corresponding block header points to; and

archiving the current state trees stored in the local space to a target archiving server, and deleting the current state trees in the local space after successful archiving.

14. The apparatus according to claim 13 , wherein the reconstructing, according to the found current state trees and node reuse information between the current state trees, a new state tree that the target block header points to comprises:

determining at least one reused tree node from the current state trees according to the node reuse information between the current state trees, the reused tree node representing a tree node reused in the current state tree that the target block header points to and a current state tree that any first block header points to;

copying the at least one reused tree node, and copying tree nodes in the current state tree that the target block header points to; and

reconstructing, according to the tree nodes obtained by copying, the new state tree that the target block header points to.

15. The apparatus according to claim 13 , wherein

a quantity of second block headers is M, M being a positive integer, and

the reconstructing, according to the new state tree that the target block header and target state data corresponding to a second block header after the target block header, a new state tree that the second block header points to comprises: performing the following processing for an m th second block header:

generating a new leaf node based on target state data corresponding to the m th second block header, the target state data corresponding to the m th second block header representing at least one piece of state data, different from each piece of state data corresponding to a previous block header of the m th second block header, in a plurality of pieces of state data corresponding to the m th second block header, and m∈[1, M];

storing the target state data corresponding to the m th second block header to the new leaf node; and

reconstructing, according to the new leaf node storing the target state data and a new state tree that the previous block header of the m th second block header points to, wherein at least one leaf node is reused in the new state tree that the m th second block header points to and the new state tree that the previous block header points to, and the previous block header is the target block header when m is 1.

16. The apparatus according to claim 13 , wherein the processor is further configured to perform:

obtaining transaction data corresponding to the second block header after the target block header, one piece of transaction data indicating a transaction operation on at least one piece of state data; and

performing a transaction operation indicated by the transaction data corresponding to each second block header sequentially in order of block height from low to high, according to the state data stored in the new state tree that the target block header points to, to obtain the target state data corresponding to each second block header.

17. The apparatus according to claim 13 , wherein the processor is further configured to perform:

traversing each second block header after the target block header, and determining a current second block header that is currently traversed; and

copying target state data corresponding to the current second block header from a current state tree that the current second block header points to.

18. The apparatus according to claim 13 , wherein the archiving the current state trees stored in the local space to a target archiving server comprises:

determining a block number of a first block header with a smallest block height in at least one first block header as a starting block number;

determining a block number of a first block header with a largest block height in at least one first block header as an ending block number;

determining the current state trees stored in the local space as the data to be archived, and generating an archiving request according to the data, the starting block number, and the ending block number; and

transmitting the archiving request to the target archiving server, the target archiving server performing a hash operation on the data according to the archiving request to obtain a data hash value, and returning the data hash value after storing the data hash value, the data, the starting block number, and the ending block number.

19. The apparatus according to claim 18 , wherein the processor is further configured to perform:

determining, in response to receiving the data hash value transmitted by the target archiving server, that the data is successfully archived; and

recording the data hash value, an archiving timestamp, the starting block number, the ending block number, and a server identifier of the target archiving server to an archiving record in the local space.

20. A non-transitory computer-readable storage medium storing one or more instructions, and the one or more instructions, when run by a processor, causing the processor to perform:

finding, in local space when an archiving task for a target block header exists, current state trees of block headers, the current state trees comprising a current state tree that the target block header points to and a current state tree that a first block header before the target block header points to;

reconstructing new state trees, comprising:

reconstructing, according to the found current state trees and node reuse information between the current state trees, a new state tree that the target block header points to, the new state tree that the target block header points to independently storing state data corresponding to the target block header;

reconstructing, according to the new state tree that the target block header points to and target state data corresponding to a second block header after the target block header, a new state tree that the second block header points to,

wherein node reuse occurs between one of the new state trees corresponding to a block header and a new state tree that a block header next to the corresponding block header points to; and

archiving the current state trees stored in the local space to a target archiving server, and deleting the current state trees in the local space after the archiving is successful.

Assignments (4)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 9, 2024
From: FENG, HAOMING; TU, HAITAO; HE, LIBAO; REN, PENG; ZHOU, SHUIPING; ZHAO, YONG; WANG, HE
To: TENCENT TECHNOLOGY (SHENZHEN) COMPANY LIMITED
Reel/Frame 069546/0300 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 18, 2024
From: CHEN, QIUPING
To: TENPAY TECHNOLOGY COMPANY LIMITED
Reel/Frame 068943/0440 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 18, 2024
From: TENPAY TECHNOLOGY COMPANY LIMITED
To: TENCENT TECHNOLOGY (SHENZHEN) COMPANY LIMITED
Reel/Frame 068944/0013 →
EMPLOYMENT AGREEMENT Recorded Oct 1, 2024
From: CHEN, JIABAO
To: TENCENT TECHNOLOGY (SHENZHEN) COMPANY LIMITED
Reel/Frame 069522/0972 →
Priority Claims (1)
CN 202110921637.4 · Aug 11, 2021 · national
Continuity (2)
Continuation PCTCN2022100036 · Jun 21, 2022
Related Publication 20230334009A1 · Oct 19, 2023