# US 2025/0094288 A1 · Metadata tree snapshot method and apparatus, metadata tree query method and apparatus, and electronic device

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2025/0094288 A1
- Document ID: US20250094288A1
- Status: Published application
- Kind: A1
- Application number: 18/897,115
- Filed: 2024-09-26
- Published: 2025-03-20
- Earliest claimed: 2023-10-16
- Assignees: Baidu International Technology (Shenzhen) Co., Ltd.
- Applicants: Baidu International Technology (Shenzhen) Co., Ltd.
- Inventors: Biao CAO; Jiwei XIONG; Yiduo WANG; Qiushi CHEN; Yan XING
- Web page: https://patentgrep.com/patent/US20250094288A1

## CPC

- G06F 11/1451: {by selection of backup contents}
- G06F 16/128: {Details of file system snapshots on the file-level, e.g. snapshot creation, administration, deletion (error detection or correction of the data by redundancy in operations or in hardware G06F11/14, G06F11/16)}
- G06F 16/2246: {Trees, e.g. B+trees}
- G06F 16/2343: {Locking methods, e.g. distributed locking or locking implementation details}
- G06F 16/24535: {of sub-queries or views}
- G06F 2201/80: Database-specific techniques
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The present disclosure provides a metadata tree snapshot method and apparatus, a metadata tree query method and apparatus, and an electronic device, and relates to the field of data processing technology, and in particular to the field of cloud computing and cloud database technology. The specific realization scheme is as follows: acquiring a basic metadata tree and a first incremental metadata tree, where the basic metadata tree is created based on first snapshot data, the basic metadata tree is locked after being created, the first snapshot data is created at a previous snapshot time instant, and the first incremental metadata tree is created based on a metadata change operation after the basic metadata tree is created; locking the first incremental metadata tree in response to reaching a current snapshot time instant; and creating second snapshot data based on the basic metadata tree and the locked first incremental metadata tree.

## Claims

### Claim 1

A metadata tree snapshot method, comprising:
acquiring a basic metadata tree and a first incremental metadata tree, wherein the basic metadata tree is created based on first snapshot data, the basic metadata tree is locked after being created, the first snapshot data is created at a previous snapshot time instant, and the first incremental metadata tree is created based on a metadata change operation after the basic metadata tree is created;
locking the first incremental metadata tree in response to reaching a current snapshot time instant; and
creating second snapshot data based on the basic metadata tree and the locked first incremental metadata tree.

### Claim 2 (depends on 1)

The method according to claim 1, wherein after the locking the first incremental metadata tree, the method further comprises:
creating a second incremental metadata tree based on a metadata change operation after the current snapshot time instant.

### Claim 3 (depends on 2)

The method according to claim 2, further comprising:
determining, in response to receiving a first metadata query request, a first metadata query result based on the basic metadata tree, the first incremental metadata tree and the second incremental metadata tree during a process of creating the second snapshot data.

### Claim 4 (depends on 3)

The method according to claim 3, wherein nodes of the first incremental metadata tree and nodes of the second incremental metadata tree both store operation types of metadata change operations, and the determining the first metadata query result based on the basic metadata tree, the first incremental metadata tree and the second incremental metadata tree comprises:
performing a metadata query on the basic metadata tree to obtain a first subquery result;
performing a metadata query on the first incremental metadata tree to obtain a second subquery result;
performing a metadata query on the second incremental metadata tree to obtain a third subquery result; and
merging the first subquery result, the second subquery result and the third subquery result based on operation types stored in nodes comprised in the second subquery result and operation types stored in nodes comprised in the third subquery result to obtain a first metadata query result.

### Claim 5 (depends on 2)

The method according to claim 2, wherein after completion of the creating of the second snapshot data, the method further comprises:
generating a new basic metadata tree based on the second snapshot data, and taking the second incremental metadata tree as a new first incremental metadata tree.

### Claim 6 (depends on 1)

The method according to claim 1, further comprising:
determining, in response to receiving a second metadata query request, a second metadata query result based on the basic metadata tree and the first incremental metadata tree before the creating of the second snapshot data or after completion of the creating of the second snapshot data.

### Claim 7 (depends on 6)

The method according to claim 6, wherein a node of the first incremental metadata tree stores an operation type of a metadata change operation, and the determining the second metadata query result based on the basic metadata tree and the first incremental metadata tree comprises:
performing a metadata query on the basic metadata tree to obtain a fourth subquery result;
performing a metadata query on the first incremental metadata tree to obtain a fifth subquery result; and
merging the fourth subquery result and the fifth subquery result based on an operation type stored in an node comprised in the fifth subquery result to obtain the second metadata query result.

### Claim 8 (depends on 1)

The method according to claim 1, wherein the creating the second snapshot data based on the basic metadata tree and the locked first incremental metadata tree comprises:
constructing a merged metadata tree based on the basic metadata tree and the locked first incremental metadata tree; and
creating the second snapshot data based on the merged metadata tree.

### Claim 9 (depends on 1)

The method according to claim 1, wherein the basic metadata tree comprises any one of the following:
a directory tree in a distributed file system; or
a metadata tree composed of metadata corresponding to data shards in a distributed database.

### Claim 10

A metadata tree query method, comprising:
acquiring a basic metadata tree and a first incremental metadata tree, wherein the basic metadata tree is created based on first snapshot data, the basic metadata tree is locked after being created, the first snapshot data is created at a previous snapshot time instant, and the first incremental metadata tree is created based on a metadata change operation after the basic metadata tree is created; and
determining a second metadata query result based on the basic metadata tree and the first incremental metadata tree in response to receiving a second metadata query request.

### Claim 11 (depends on 10)

The method according to claim 10, wherein a node of the first incremental metadata tree store an operation type of a metadata change operation, and the determining the second metadata query result based on the basic metadata tree and the first incremental metadata tree comprises:
performing a metadata query on the basic metadata tree to obtain a fourth subquery result;
performing a metadata query on the first incremental metadata tree to obtain a fifth subquery result; and
merging the fourth subquery result and the fifth subquery result based on an operation type stored in an node comprised in the fifth subquery result to obtain the second metadata query result.

### Claim 12

A metadata tree snapshot apparatus, comprising:
at least one processor; and
a memory communicatively connected to the at least one processor; wherein
the memory stores an instruction executable by the at least one processor, and the instruction is executed by the at least one processor to enable the at least one processor to:
acquire a basic metadata tree and a first incremental metadata tree, wherein the basic metadata tree is created based on first snapshot data, the basic metadata tree is locked after being created, the first snapshot data is created at a previous snapshot time instant, and the first incremental metadata tree is created based on a metadata change operation after the basic metadata tree is created;
lock the first incremental metadata tree in response to reaching the current snapshot time instant; and
create second snapshot data based on the basic metadata tree and the locked first incremental metadata tree.

### Claim 13 (depends on 12)

The apparatus according to claim 12, wherein the at least one processor is further enabled to:
create a second incremental metadata tree based on a metadata change operation after the current snapshot time instant after locking the first incremental metadata tree.

### Claim 14 (depends on 13)

The apparatus according to claim 13, wherein the at least one processor is further enable to:
determine, in response to receiving a first metadata query request, a first metadata query result based on the basic metadata tree, the first incremental metadata tree and the second incremental metadata tree during a process of creating the second snapshot data.

### Claim 15 (depends on 14)

The apparatus according to claim 14, wherein nodes of the first incremental metadata tree and nodes of the second incremental metadata tree both store operation types of metadata change operations, and when determining the first metadata query result based on the basic metadata tree, the first incremental metadata tree and the second incremental metadata tree, the at least one processor is specifically enabled to:
perform a metadata query on the basic metadata tree to obtain a first subquery result;
perform a metadata query on the first incremental metadata tree to obtain a second subquery result;
perform a metadata query on the second incremental metadata tree to obtain a third subquery result; and
merge the first subquery result, the second subquery result and the third subquery result based on operation types stored in nodes comprised in the second subquery result and operation types stored in nodes comprised in the third subquery result to obtain a first metadata query result.

### Claim 16 (depends on 13)

The apparatus according to claim 13, wherein the at least one processor is further enabled to:
generate a new basic metadata tree based on the second snapshot data and take the second incremental metadata tree as a new first incremental metadata tree, after completion of the creating of the second snapshot data.

### Claim 17 (depends on 1)

A metadata tree query apparatus, comprising:
at least one processor; and
a memory communicatively connected to the at least one processor; wherein
the memory stores an instruction executable by the at least one processor, and the instruction is executed by the at least one processor to enable the at least one processor to perform the method according to claim 1.

### Claim 18 (depends on 17)

The apparatus according to claim 17, wherein a node of the first incremental metadata tree store an operation type of a metadata change operation and the at least one processor is further enabled to:
perform a metadata query on the basic metadata tree to obtain a fourth subquery result;
perform a metadata query on the first incremental metadata tree to obtain a fifth subquery result; and
merge the fourth subquery result and the fifth subquery result based on an operation type stored in a node comprised in the fifth subquery result to obtain the second metadata query result.

### Claim 19 (depends on 1)

A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to perform the method according to claim 1.

### Claim 20 (depends on 10)

A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to perform the method according to claim 10.
