# US 2019/0171537 A1 · Method for storing data shards, 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 2019/0171537 A1
- Document ID: US20190171537A1
- Status: Published application
- Kind: A1
- Application number: 16/270,048
- Filed: 2019-02-07
- Published: 2019-06-06
- Earliest claimed: 2016-08-10
- Assignees: Huawei Technologies Co., Ltd.
- Applicants: Huawei Technologies Co., Ltd.
- Inventors: Huaqiong Wang; Chao Gao
- Web page: https://patentgrep.com/patent/US20190171537A1

## CPC

- H04L 67/1097: for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
- G06F 11/2082: {Data synchronisation}
- G06F 11/2094: {Redundant storage or storage space (G06F11/2056 takes precedence)}
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

This application relates to distributed storage, and in particular, to a distributed shard storage technology. In a method for storing data shards in a distributed storage system, M data nodes on which to-be-stored data will be stored are determined, N replicas of the to-be-stored data are obtained, and each of the N replicas is sharded into X data shards in a same sharding mode. Then the to-be-stored data is stored on the M storage nodes, that is, N replicas of each of the X data shards are respectively stored on N storage nodes, and a quantity of data shards whose data shard replicas are stored on same N storage nodes is P or P+1, where P is an integer quotient of X divided by CMN.

## Claims

### Claim 1

A method for storing data shards, wherein the method comprises:
determining M storage nodes on which data will be stored;
obtaining N replicas of the data, wherein the N replicas comprise original data of the data and N−1 pieces of backup data of the original data, and sharding each of the N replicas into X data shards in a same sharding mode, so that each data shard has N data shard replicas, wherein N is less than or equal to M; and
storing the N replicas of the data on the M storage nodes, wherein the N data shard replicas of each of the X data shards are respectively stored on N storage nodes in the M storage nodes, and a quantity of data shards whose data shard replicas are stored on same N storage nodes is P or P+1, wherein P is an integer quotient of X divided by CMN.

### Claim 2 (depends on 1)

The method according to claim 1, wherein sharding each of the N replicas into X data shards in the same sharding mode specifically comprises:
determining an optimal shard base Y of the data according to the quantity N of the replicas and the quantity M of the storage nodes, wherein the optimal shard base Y is equal to CMN, the quantity X of the shards of the data is equal to a product of the optimal shard base Y and a coefficient K, and K is an integer greater than or equal to 1; and
sharding each of the N replicas into the X data shards in the same sharding mode.

### Claim 3 (depends on 1)

The method according to claim 1, wherein sharding each of the N replicas into X data shards in the same sharding mode specifically comprises:
determining an optimal shard base Y of the data according to the quantity N of the replicas and the quantity M of the storage nodes, wherein the optimal shard base Y is equal to CMN;
obtaining the quantity X of the shards of the data according to the optimal shard base Y, wherein the quantity X of the shards of the data is less than a product of the optimal shard base Y and a coefficient K, and K is an integer greater than or equal to 1; and
sharding each of the N replicas into the X data shards in the same sharding mode.

### Claim 4 (depends on 2)

The method according to claim 2, wherein the coefficient K is determined according to a load balancing requirement of a distributed storage system, and a degree of load balancing of the data is higher as the value of K increases.

### Claim 5 (depends on 1)

The method according to claim 1, wherein obtaining the quantity N of the replicas of the data specifically comprises:
determining the quantity N of the replicas of the data according to a security requirement of the data, wherein if the quantity N of the replicas is greater, a higher security requirement of the data can be satisfied.

### Claim 6 (depends on 1)

The method according to claim 1, wherein the quantity X of the data shards is determined according to a load balancing requirement of a distributed storage system, and a degree of load balancing of the data is higher as the value of X increases.

### Claim 7 (depends on 1)

The method according to claim 1, wherein storing the N replicas of the data on the M storage nodes specifically comprises:
determining CMN data node combinations for selecting N data nodes from the M data nodes when storing the N replicas of the data on the M data nodes;
determining the quotient P obtained by dividing the quantity X of the shards by CMN, and a remainder Q; and
selecting, from the CMN data node combinations, Q data node combinations for storing P+1 data shards, and using remaining CMN−Q data node combinations for storing P data shards, wherein the N replicas of each data shard are respectively stored on N different data nodes in a data node combination.

### Claim 8

A distributed storage device, wherein the device is used in a distributed storage system comprising at least two storage nodes, and configured to determine a policy for storing shards of data, and the device comprises:
a memory that stores at least one instruction, and
a processor coupled with the memory, wherein the processor executes the at least one instruction stored in the memory to perform operations, comprising:
determining M storage nodes on which data will be stored,
obtaining N replicas of the data, wherein the N replicas comprise original data of the data and N−1 pieces of backup data of the original data, and sharding each of the N replicas into X data shards in a same sharding mode, so that each data shard has N data shard replicas, wherein N is less than or equal to M, and
storing the N replicas of the data on the M storage nodes, wherein the N data shard replicas of each of the X data shards are respectively stored on N storage nodes in the M storage nodes, and a quantity of data shards whose data shard replicas are stored on same N storage nodes is P or P+1, wherein P is an integer quotient of X divided by CMN.

### Claim 9

A distributed storage system, comprising:
at least two storage nodes; and
at least one management device communicatively coupled with the at least two storage nodes, wherein the management device is configured to determine a policy for storing shards of data, and wherein the management device comprises:
a memory that stores at least one instruction, and
a processor coupled with the memory, wherein the processor executes the at least one instruction stored in the memory to perform operations, comprising:
determining M storage nodes on which data will be stored,
obtaining N replicas of the data, wherein the N replicas con rise original data of the data and N−1 pieces of backup data of the original data, and sharding each of the N replicas into X data shards in a same sharding mode, so that each data shard has N data shard replicas, wherein N is less than or equal to M, and
storing the N replicas of the data on the M storage nodes, wherein the N data shard replicas of each of the X data shards are respectively stored on N storage nodes in the M storage nodes, and a quantity of data shards whose data shard replicas are stored on same N storage nodes is P or P+1, wherein P is an integer quotient of X divided by CMN.
