# US 2021/0334252 A1 · Data Redistribution Method, Apparatus, and System

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

- Number: US 2021/0334252 A1
- Document ID: US20210334252A1
- Status: Published application
- Kind: A1
- Application number: 17/370,275
- Filed: 2021-07-08
- Published: 2021-10-28
- Earliest claimed: 2019-09-11
- Assignees: Huawei Technologies Co., Ltd.
- Applicants: Huawei Technologies Co., Ltd.
- Inventors: Qiang Tong
- Web page: https://patentgrep.com/patent/US20210334252A1

## CPC

- G06F 16/214: {Database migration support}
- G06F 16/27: Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
- 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/164: {File meta data generation}
- G06F 16/2272: {Management thereof}
- G06F 16/24544: {Join order optimisation}
- G06F 16/278: {Data partitioning, e.g. horizontal or vertical partitioning}
- H04L 9/088: {Usage controlling of secret information, e.g. techniques for restricting cryptographic keys to pre-authorized uses, different access levels, validity of crypto-period, different key- or password length, or different strong and weak cryptographic algorithms (network architectures or network communication protocols for using time-dependent keys in a packet data network H04L63/068)}
- H04L 9/3236: {using cryptographic hash functions}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)

## Abstract

A method includes determining a first node set and a second node set that are in a distributed database and that are separately associated with a first data table, where data in the first data table is stored in the first node set, migrating the data from the first node set to the second node set, receiving, in a process of migrating the data, a target service request for the first data table, determining, in response to the target service request, a third node set in the first node set and the second node set that is configured to respond to the target service request, and sending the target service request to a first data node in the third node set.

## Claims

### Claim 1

A data redistribution method, comprising:
determining a first node set and a second node set that are in a distributed database and that are separately associated with a first data table, wherein data in the first data table is stored in the first node set;
migrating the data from the first node set to the second node set;
receiving, in a process of migrating the data, a target service request for the first data table;
determining, in response to the target service request, a third node set in the first node set and the second node set that is configured to respond to the target service request; and
sending the target service request to a first data node in the third node set.

### Claim 2 (depends on 1)

The data redistribution method of claim 1, wherein when the target service request is a data addition request, determining that the third node set is configured to respond to the data addition request.

### Claim 3 (depends on 2)

The data redistribution method of claim 2, further comprising:
calculating a hash value based on a key value of newly-added data carried in the data addition request; and
determining, in the second node set, a second data node corresponding to the hash value, wherein the second data node belongs to the third node set.

### Claim 4 (depends on 1)

The data redistribution method of claim 1, wherein when the target service request is a data deletion request, a data modification request, or a data query request associated with the first data table, determining, in the first node set, a second data node configured to respond to the target service request, and determining, in the second node set, a third data node configured to respond to the target service request, wherein the second data node determined from the first node set and the third data node determined from the second node set form the third node set.

### Claim 5 (depends on 1)

The data redistribution method of claim 1, further comprising:
filtering the data in the first node set to obtain to-be-migrated data that is not stored in the second node set before migration; and
migrating the to-be-migrated data from the first node set to the second node set.

### Claim 6 (depends on 5)

The data redistribution method of claim 5, further comprising:
obtaining a first mapping relationship between the data in the first data table and a second data node in the first node set;
obtaining a second mapping relationship between the data in the first data table and a third data node in the second node set; and
determining target data on the second data node as the to-be-migrated data when the second data node and the third data node are different.

### Claim 7 (depends on 1)

The data redistribution method of claim 1, further comprising separately migrating different data in the first data table from the first node set to the second node set through a plurality of distributed transactions that are serially executed.

### Claim 8 (depends on 7)

The data redistribution method of claim 7, further comprising:
selecting, from unmigrated data in the first data table that corresponds to a currently executed distributed transaction, to-be-migrated data that meets a migration condition; and
migrating the to-be-migrated data from the first node set to the second node set,
wherein the to-be-migrated data is locked in a migration process, and
wherein the migration condition comprises either an amount of the to-be-migrated data that is migrated through the currently executed distributed transaction is less than or equal to a specified threshold of the amount of the to-be-migrated data or a migration duration of migration through the currently executed distributed transaction is less than or equal to a specified duration threshold.

### Claim 9 (depends on 8)

The data redistribution method of claim 8, further comprising:
separately generating n distributed plans for n data nodes based on the currently executed distributed transaction, wherein the first node set comprises the n data nodes, wherein the n data nodes are in a one-to-one correspondence with the n distributed plans, and wherein n is a positive integer; and
instructing the n data nodes to separately execute the n distributed plans to concurrently select to-be-migrated data that meets a migration subcondition from unmigrated data, wherein the to-be-migrated data is on the n data nodes in the first data table, and wherein the subcondition is determined based on the migration condition; and
sending, from the n data nodes, the to-be-migrated data to the second node set.

### Claim 10 (depends on 8)

The data redistribution method of claim 8, further comprising rolling back data that has been migrated through the currently executed distributed transaction when a rollback trigger event is detected during the process of migrating the data.

### Claim 11 (depends on 7)

The data redistribution method of claim 7, further comprising rolling back data that has been migrated through the plurality of distributed transactions when a rollback trigger event is detected during the process of migrating the data.

### Claim 12 (depends on 1)

The data redistribution method of claim 1, further comprising setting a deletion flag for migrated data in the first node set in the first data table.

### Claim 13

A computing device, comprising:
a memory configured to store instructions; and
a processor coupled to the memory and configured to execute the instructions to cause the computing device to be configured to:
determine a first node set and a second node set that are in a distributed database and that are separately associated with a first data table, wherein data in the first data table is stored in the first node set;
migrate the data from the first node set to the second node set;
receive, in a process of migrating the data, a target service request for the first data table;
determine, in response to the target service request, a third node set in the first node set and the second node set that is configured to respond to the target service request; and
send the target service request to a first data node in the third node set.

### Claim 14 (depends on 13)

The computing device of claim 13, wherein when the target service request is a data addition request, the processor is further configured to execute the instructions to determine, in the second node set, that the third node set is configured to respond to the data addition request.

### Claim 15 (depends on 14)

The computing device of claim 14, wherein the processor is further configured to execute the instructions to cause the computing device to be configured to:
calculate a hash value based on a key value of newly-added data carried in the data addition request; and
determine, in the second node set, a second data node corresponding to the hash value, wherein the second data node belongs to the third node set.

### Claim 16 (depends on 13)

The computing device of claim 13, wherein when the target service request is a data deletion request, a data modification request, or a data query request associated with the first data table, the processor is further configured to execute the instructions to cause the computing device to be configured to determine, in the first node set, a second data node configured to respond to the target service request, and determine, in the second node set, a third data node configured to respond to the target service request, wherein the second data node determined from the first node set and the third data node determined from the second node set form the third node set.

### Claim 17 (depends on 13)

The computing device of claim 13, wherein the processor is further configured to:
filter the data in the first node set to obtain to-be-migrated data that is not stored in the second node set before migration; and
migrate the to-be-migrated data from the first node set to the second node set.

### Claim 18 (depends on 17)

The computing device of claim 17, wherein the processor is further configured to:
obtain a first mapping relationship between the data in the first data table and a second data node in the first node set;
obtain a second mapping relationship between the data in the first data table and a third data node in the second node set; and
determine target data on the second data node as the to-be-migrated data when the second data node and the third data node are different.

### Claim 19 (depends on 13)

The computing device of claim 13, wherein the processor is further configured to separately migrate different data in the first data table from the first node set to the second node set through a plurality of distributed transactions that are serially executed.

### Claim 20

A distributed database system, comprising:
a data node; and
a management node configured to:
determine a first node set and a second node set that are in a distributed database and that are separately associated with a first data table, wherein data in the first data table is stored in the first node set;
migrate the data from the first node set to the second node set;
receive, in a process of migrating the data, a target service request for the first data table;
determine, in response to the target service request, a third node set in the first node set and the second node set that is configured to respond to the target service request; and
send the target service request to a first data node in the third node set.
