# US 11,119,688 B2 · Replica processing method and node, storage system, server, and readable medium

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

- Number: US 11,119,688 B2
- Document ID: US11119688B2
- Status: Granted
- Kind: B2
- Application number: 16/852,746
- Filed: 2020-04-20
- Published: 2020-11-05
- Granted: 2021-09-14
- Earliest claimed: 2019-04-30
- Assignees: Beijing Baidu Netcom Science Technology Co., Ltd.
- Applicants: Beijing Baidu Netcom Science and Technology Co., Ltd.
- Inventors: Zhengli Yi; Pengfei Zheng; Xinxing Wang
- Web page: https://patentgrep.com/patent/US11119688B2

## CPC

- G06F 3/065: {Replication mechanisms}
- G06F 3/0652: {Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket}
- G06F 3/0608: {Saving storage space on storage systems}
- G06F 3/0619: {in relation to data integrity, e.g. data losses, bit errors}
- G06F 3/067: {Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The present disclosure provides a replica processing method based on a raft protocol. The method includes: for a node to be processed corresponding to a raft replica group, determining a replica to be cleaned corresponding to the node, the raft replica group including a first node and at least one second node; for the node, obtaining replica configuration information of the raft replica group, the replica configuration information including one or more primary replicas stored by the first node and one or more secondary replicas stored by the at least one second node; and for the node, determining whether the replica configuration information includes the replica to be cleaned, if yes, reserving the replica to be cleaned, and if no, deleting the replica to be cleaned. The present disclosure also provides a replica processing node, a distributed storage system, a server, and a computer-readable medium.

## Claims

### Claim 1

A replica processing method based on a raft protocol, comprising:
for a node to be processed corresponding to a raft replica group, determining a replica to be cleaned corresponding to the node to be processed, wherein the raft replica group comprises a first node for storing one or more primary replicas and at least one second node for storing one or more secondary replicas;
for the node to be processed corresponding to the raft replica group, obtaining replica configuration information of the raft replica group corresponding to the node to be processed, wherein the replica configuration information comprises the one or more primary replicas stored by the first node in the raft replica group and the one or more secondary replicas stored by the at least one second node in the raft replica group; and
for the node to be processed corresponding to the raft replica group, determining whether the replica configuration information corresponding to the node to be processed comprises the replica to be cleaned corresponding to the node to be processed, reserving the replica to be cleaned corresponding to the node to be processed when the replica configuration information comprises the replica to be cleaned, and deleting the replica to be cleaned corresponding to the node to be processed when the replica configuration information does not comprise the replica to be cleaned.

### Claim 2 (depends on 1)

The method according to claim 1, wherein for the node to be processed corresponding to the raft replica group, determining the replica to be cleaned corresponding to the node to be processed, comprises:
for the node to be processed corresponding to the raft replica group, sending a first request for acquiring a first replica list of the node to be processed to a master;
for the node to be processed corresponding to the raft replica group, receiving the first replica list sent back by the master in response to the first request; and
for the node to be processed corresponding to the raft replica group, determining the replica to be cleaned corresponding to the node to be processed based on replicas in a second replica list stored in the node to be processed and replicas in the first replica list, wherein the replica to be cleaned corresponding to the node to be processed is a replica that is not included in the first replica list but in the second replica list.

### Claim 3 (depends on 1)

The method according to claim 1, wherein for the node to be processed corresponding to the raft replica group, obtaining the replica configuration information of the raft replica group corresponding to the node to be processed, comprises:
for the node to be processed corresponding to the raft replica group, according to the determined replica to be cleaned corresponding to the node to be processed, sending a second request for acquiring replica configuration information to the first node in the raft replica group, such that the first node in the raft replica group sends back the replica configuration information in response to the second request.

### Claim 4 (depends on 3)

The method according to claim 3, wherein the second request comprises an empty log, and for the node to be processed corresponding to the raft replica group, the first node in the raft replica group sends back the replica configuration information acquisition in response to the second request by:
the first node in the raft replica group sending the empty log to at least one second node in the raft replica group; and
when the first node in the raft replica group receives at least preset number of synchronization empty log confirmation messages, the first node in the raft replica group sending back the replica configuration information, wherein the preset number is greater than or equal to half of a total number of the first node and the second nodes in the raft replica group.

### Claim 5

A replica processing node, comprising a non-transitory computer-readable medium comprising computer-executable instructions stored thereon, and an instruction execution system which is configured by the instructions to implement:
a determining module, configured to, for a node to be processed corresponding to a raft replica group, determine a replica to be cleaned corresponding to the node to be processed, wherein the raft replica group comprises a first node configured to store one or more primary replicas and at least one second node configured to store one or more secondary replicas;
an obtaining module, configured to, for the node to be processed corresponding to the raft replica group, obtain replica configuration information of the raft replica group corresponding to the node to be processed, wherein the replica configuration information comprises the one or more primary replicas stored by the first node in the raft replica group and the one or more secondary replicas stored by the at least one second node in the raft replica group; and
a judging module, configured to, for the node to be processed corresponding to the raft replica group, determine whether the replica configuration information corresponding to the node to be processed comprises the replica to be cleaned corresponding to the node to be processed; and
a cleaning module, configured to, for the node to be processed corresponding to the raft replica group, when the judging module determines that the replica configuration information corresponding to the node to be processed comprises the replica to be cleaned corresponding to the node to be processed, reserve the replica to be cleaned corresponding to the node to be processed; and for the node to be processed corresponding to the raft replica group, when the judging module determines that the replica configuration information corresponding to the node to be processed does not comprise the replica to be cleaned corresponding to the node to be processed, delete the replica to be cleaned corresponding to the node to be processed.

### Claim 6 (depends on 5)

The replica processing node according to claim 5, wherein the determining module is configured to, for the node to be processed corresponding to the raft replica group, send a first request for acquiring a first replica list of the node to be processed to a master; for the node to be processed corresponding to the raft replica group, receive the first replica list sent back by the master in response to the first request; and for the node to be processed corresponding to the raft replica group, determine the replica to be cleaned corresponding to the node to be processed according to replicas in a second replica list stored in the node to be processed and replicas in the first replica list, wherein the replica to be cleaned corresponding to the node to be processed is a replica that is not included in the first replica list but in the second replica list.

### Claim 7 (depends on 5)

The replica processing node according to claim 5, wherein the obtaining module is configured to, for the node to be processed corresponding to the raft replica group, according to the determined replica to be cleaned corresponding to the node to be processed, send a second request for acquiring replica configuration information to the first node in the raft replica group, such that the first node in the raft replica group sends back the replica configuration information in response to the second request.

### Claim 8 (depends on 7)

The replica processing node according to claim 7, wherein the second request comprises an empty log, and for the node to be processed corresponding to the raft replica group, the first node in the raft replica group sends back the replica configuration information in response to the second request by:
the first node in the raft replica group sending the empty log to at least one second node in the raft replica group; and
when the first node in the raft replica group receives at least preset number of synchronization empty log confirmation messages, the first node in the raft replica group sending back the replica configuration information to the obtaining module, wherein the preset number is greater than or equal to half of a total number of the first node and the second nodes in the raft replica group.

### Claim 9

A distributed storage system comprising a master, at least one raft replica group, and a replica processing node, wherein each raft replica group comprises a first node configured to store one or more primary replicas and at least one second node configured to store one or more secondary replicas; and
for a node to be processed corresponding to a raft replica group, after a garbage cleanup is triggered, the replica processing node is configured to:
determine a replica to be cleaned corresponding to the node to be processed;
obtain replica configuration information of the raft replica group corresponding to the node to be processed, wherein the replica configuration information comprises the one or more primary replicas stored by the first node in the raft replica group and the one or more secondary replicas stored by the at least one second node in the raft replica group; and
determine whether the replica configuration information corresponding to the node to be processed comprises the replica to be cleaned corresponding to the node to be processed, if yes, reserve the replica to be cleaned corresponding to the node to be processed, and if no, delete the replica to be cleaned corresponding to the node to be processed.

### Claim 10 (depends on 9)

The distributed storage system according to claim 9, wherein the replica processing node is configured to send a first request for acquiring a first replica list of the node to be processed to a master, receive the first replica list sent back by the master in response to the first request, and determine the replica to be cleaned corresponding to the node to be processed based on replicas in a second replica list stored in the node to be processed and replicas in the first replica list, wherein the replica to be cleaned corresponding to the node to be processed is a replica that is not included in the first replica list but in the second replica list.

### Claim 11 (depends on 9)

The distributed storage system according to claim 9, wherein the replica processing node is configured to send a second request for acquiring replica configuration information to the first node in the raft replica group corresponding to the node to be processed according to the replica to be cleaned corresponding to the node to be processed, and the first node in the raft replica group corresponding to the node to be processed is configured to send back the replica configuration information to the replica processing node in response to the second request.

### Claim 12 (depends on 11)

The distributed storage system according to claim 11, wherein the second request comprises an empty log, and the first node in the raft replica group corresponding to the node to be processed is configured to:
send the empty log to at least one second node in the raft replica group; and
when at least preset number of synchronization empty log confirmation messages are received, send back the replica configuration information to the replica processing node, wherein the preset number is greater than or equal to half of a total number of the first node and the second nodes in the raft replica group.

### Claim 13 (depends on 9)

The distributed storage system according to claim 9, wherein the distributed storage system is a distributed storage system based on a distributed consensus (Raft) protocol.

### Claim 14 (depends on 9)

The distributed storage system according to claim 9, wherein for the node to be processed corresponding to the raft replica group, the replica processing node is the node to be processed.
