# US 2018/0324033 A1 · System and method for data replication using a single master failover protocol

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

- Number: US 2018/0324033 A1
- Document ID: US20180324033A1
- Status: Published application
- Kind: A1
- Application number: 16/024,502
- Filed: 2018-06-29
- Published: 2018-11-08
- Earliest claimed: 2012-01-17
- Assignees: Amazon Technologies, Inc.
- Applicants: Amazon Technologies, Inc.
- Inventors: Timothy Andrew Rath; Jakub Kulesza; David Alan Lutz
- Web page: https://patentgrep.com/patent/US20180324033A1

## CPC

- H04L 41/0668: by dynamic selection of recovery network elements, e.g. replacement by the most appropriate element after failure
- G06F 3/0617: {in relation to availability}
- G06F 3/0653: {Monitoring storage devices or systems}
- G06F 3/0659: {Command handling arrangements, e.g. command buffers, queues, command scheduling}
- G06F 3/0683: {Plurality of storage devices}
- G06F 11/1425: {by reconfiguration of node membership}
- G06F 11/1662: {the resynchronized component or unit being a persistent storage device (re-synchronization of failed mirror storage G06F11/2082; rebuild or reconstruction of parity RAID storage G06F11/1008)}
- G06F 11/2028: {eliminating a faulty processor or activating a spare}
- G06F 11/2041: {with more than one idle spare processing component}
- G06F 11/2094: {Redundant storage or storage space (G06F11/2056 takes precedence)}
- G06F 11/2097: {maintaining the standby controller/processing unit updated (initialisation or re-synchronisation thereof G06F11/1658 and subgroups)}
- 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]
- H04L 67/51: Discovery or management thereof, e.g. service location protocol [SLP] or web services
- G06F 11/2048: {where the redundant components share neither address space nor persistent storage}
- G06F 2201/825: the problem or solution involving locking
- 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

A system that implements a data storage service may store data on behalf of storage service clients. The system may maintain data in multiple replicas of various partitions that are stored on respective computing nodes in the system. The system may employ a single master failover protocol, usable when a replica attempts to become the master replica for a replica group of which it is a member. Attempting to become the master replica may include acquiring a lock associated with the replica group, and gathering state information from the other replicas in the group. The state information may indicate whether another replica supports the attempt (in which case it is included in a failover quorum) or stores more recent data or metadata than the replica attempting to become the master (in which case synchronization may be required). If the failover quorum includes enough replicas, the replica may become the master.

## Claims

### Claim 1

A system, comprising:
a plurality of computing nodes, each comprising at least one processor and memory, wherein the plurality of computing nodes is configured to implement a data storage service;
wherein the data storage service maintains data on behalf of one or more storage service clients, wherein maintaining the data comprises storing two or more replicas of the data on respective computing nodes in the system, wherein the two or more replicas make up a replica group, wherein the replica group maintains an indicator of its membership version, wherein the membership version is updated each time the membership of the replica group changes, wherein at most one of the replicas in the replica group can act as a master replica for the replica group at a time, and wherein replicas in the replica group that are not acting as the master replica act as slave replicas in the replica group;
wherein one of the two or more replicas is configured to attempt to assume a role of master replica for the replica group, and wherein attempting to assume the role of master replica comprises:
acquiring a lock associated with the replica group, wherein only one of the two or more replicas can hold the lock at a time;
gathering state information from at least some of the two or more replicas other than the one of the replicas;
for each of the at least some of the two or more replicas:
determining, dependent on the state information, whether the replica supports the attempt to assume the role of master replica; and
in response to determining that the replica supports the attempt to assume the role of master replica, including the replica in a failover quorum; and
wherein the one of the replicas is further configured to:
determine whether at least a pre-determined number of replicas are included in the failover quorum; and
assume the role of master replica for the two or more replicas in response to determining that at least the pre-determined number of replicas are included in the failover quorum.

### Claim 2 (depends on 1)

The system of claim 1, wherein determining whether a replica supports an attempt to assume the role of master replica comprises one or more of:
determining whether the replica has observed a more recent membership version for the replicas storing the data than a most recent membership version observed by the one of the replicas attempting to assume the role of master replica, wherein the membership version is incremented each time a membership change is made in the replica group;
determining whether the replica is no longer hosted on the computing node from which the state information for the replica is gathered; or
determining whether the replica has seen a more recent value for the lock than a most recent lock value observed by the one of the replicas attempting to assume the role of master replica, wherein the lock value is incremented each time the lock is acquired by a different replica.

### Claim 3 (depends on 1)

The system of claim 1, wherein the one of the replicas is further configured to abandon the attempt to assume the role of master replica for the replica group in response to determining that fewer than the pre-determined number of replicas are included in the failover quorum.

### Claim 4 (depends on 1)

The system of claim 1, wherein the one of the replicas is further configured to, prior to assuming the role of master replica for the replica group:
determine whether one of the replicas added to the failover quorum stores data or metadata that was more recently updated than data or metadata stored by the one of the replicas; and
in response to determining that a given replica of the replicas added to the failover quorum stores data or metadata that was more recently updated than data or metadata stored by the one of the replicas, attempting to synchronize the data or metadata stored by the one of the replicas with the more recently updated data or metadata stored by the given replica.

### Claim 5 (depends on 4)

The system of claim 4, wherein the one of the replicas is further configured to, prior to assuming the role of master replica for the replica group:
in response to successfully synchronizing the data or metadata stored by the one of the replicas with the more recently updated data or metadata stored by the given replica:
propagate the more recently updated data or metadata to one or more other replicas in the replica group;
propagate metadata indicating an impending change of mastership for the replica group to the other replicas of the replica group;
determine whether the propagation of the metadata indicating an impending change of mastership meets a pre-determined durability requirement in the replica group; and
in response to determining that the propagation of the metadata indicating an impending change of mastership meets the pre-determined durability requirement in the replica group, commit the more recently updated data or metadata in the system.

### Claim 6

A method, comprising:
performing by a computer:
one of two or more replicas that make up a replica group attempting to assume a role of master replica for the replica group, wherein the replica group maintains an indicator of its membership version, wherein the membership version is updated each time the membership of the replica group changes, wherein the two or more replicas store data on respective computing nodes of a plurality of computing nodes that collectively implement a data store, wherein at most one of the replicas in the replica group can act as a master replica for the replica group at a time, and wherein replicas in the replica group that are not acting as the master replica act as slave replicas in the replica group;
wherein attempting to assume the role of master replica comprises:
indicating an intention to assume the role of master replica;
receiving credentials authorizing the attempt to assume the role of master replica, wherein when generated, the credentials are the highest credentials existing in the data store;
gathering state information from at least some of the two or more replicas other than the one of the replicas;
for each of the at least some of the two or more replicas:
determining, dependent on the state information, whether the replica supports the attempt to assume the role of master replica, wherein said determining is further dependent on the received credentials; and
in response to determining that the replica supports the attempt to assume the role of master replica, including the replica in a failover quorum; and
the one of the replicas assuming the role of master replica for the replica group in response to determining that at least a pre-determined number of replicas are included in the failover quorum.

### Claim 7 (depends on 6)

The method of claim 6, wherein determining whether a replica supports an attempt to assume the role of master replica comprises one or more of:
determining whether the replica has observed a more recent membership version for the replicas storing the data than a most recent membership version observed by the one of the replicas attempting to assume the role of master replica, wherein the membership version is incremented each time a membership change is made in the replica group;
determining whether the replica is no longer hosted on the computing node from which the state information for the replica is gathered; or
determining whether the replica has seen a more recent value for a lock associated with the replica group than a most recent lock value observed by the one of the replicas attempting to assume the role of master replica, wherein the most recent lock value observed by the one of the replicas attempting to assume the role of master replica is included in the received credentials.

### Claim 8 (depends on 6)

The method of claim 6, wherein said attempting to assume the role of master for the replica group is performed in response to a failure of a master replica, a failure of a computing node on which a master replica is hosted, a communication failure between a master replica and one or more other components of the data store, or a membership change in the replica group.

### Claim 9 (depends on 6)

The method of claim 6,
wherein the data store stores data in a plurality of tables;
wherein, for each table, the data store maintains a plurality of replicas of table data in each of one or more partitions of the table on respective computing nodes; and
wherein said maintaining the data comprises maintaining two or more replicas of the data stored in a given partition of a table on respective computing nodes.

### Claim 10 (depends on 9)

The method of claim 9,
wherein said indicating an intention to assume the role of master replica comprises expressing an interest in acquiring a lock associated with the replica group; and
wherein the lock associated with the replica group is identified by an identifier of the given partition.

### Claim 11 (depends on 6)

The method of claim 6,
wherein said indicating an intention to assume the role of master replica comprises expressing an interest in acquiring a lock associated with the replica group to an external lock service or lock manager;
wherein the credentials are received from the external lock service or lock manager;
wherein the method further comprises acquiring the lock associated with the replica group; and
wherein only one of the two or more replicas can hold the lock at a time.

### Claim 12 (depends on 6)

The method of claim 6,
wherein said indicating an intention to assume the role of master replica comprises expressing an interest in acquiring a lock associated with the replica group;
wherein the method further comprises acquiring the lock associated with the replica group; and
wherein a lock value for the lock is incremented each time the lock is acquired by a replica.

### Claim 13 (depends on 6)

The method of claim 6, wherein the pre-determined number of replicas is expressed in terms of a number of replicas stored on computing nodes in each of a particular number of different locations.

### Claim 14 (depends on 6)

The method of claim 6, wherein said gathering comprises gathering state information until: the pre-determined number of replicas has been added to the failover quorum, state information has been gathered from all of the two or more replicas, it is determined that there are not enough replicas supporting the attempt to be able to add the pre-determined number of replicas to the failover quorum, or a pre-determined time limit is reached.

### Claim 15 (depends on 6)

The method of claim 6, further comprising, subsequent to the one of the replicas assuming the role of master replica for the replica group:
another replica attempting to assume the role of master replica for the replica group; and
the other replica abandoning its attempt to assume the role of master replica for the replica group in response to determining that fewer than the pre-determined number of replicas are included in its failover quorum.

### Claim 16 (depends on 6)

The method of claim 6, further comprising, prior to the one of the replicas assuming the role of master replica for the replica group:
the one of the replicas determining whether one of the replicas added to the failover quorum stores data or metadata that was more recently updated than data or metadata stored by the one of the replicas; and
in response to determining that a given replica of the replicas added to the failover quorum stores data or metadata that was more recently updated than data or metadata stored by the one of the replicas, the one of the replicas attempting to synchronize the data or metadata stored by the one of the replicas with the more recently updated data or metadata stored by the given replica.

### Claim 17 (depends on 16)

The method of claim 16, further comprising, prior to the one of the replicas assuming the role of master replica for the replica group:
in response to successfully synchronizing the data or metadata stored by the one of the replicas with the more recently updated data or metadata stored by the given replica, the one of the replicas propagating the more recently updated data or metadata to one or more other replicas in the replica group.

### Claim 18 (depends on 17)

The method of claim 17, further comprising, prior to the one of the replicas assuming the role of master replica for the replica group, the one of the replicas:
propagating metadata indicating an impending change of mastership for the replica group to the other replicas of the replica group;
determining whether the propagation of the metadata indicating an impending change of mastership meets a pre-determined durability requirement in the replica group; and
in response to determining that the propagation of the metadata indicating an impending change of mastership meets the pre-determined durability requirement in the replica group, committing the more recently updated data or metadata in the data store.

### Claim 19 (depends on 6)

The method of claim 6, wherein the data store maintains data on behalf of one or more storage service clients.

### Claim 20

A non-transitory, computer-readable storage medium storing program instructions that when executed on one or more computers cause the one or more computers to perform:
maintaining data in a distributed data store, wherein maintaining the data comprises maintaining two or more replicas of the data stored on respective computing nodes, wherein the two or more replicas make up a replica group, wherein the replica group maintains an indicator of its membership version, wherein the membership version is updated each time the membership of the replica group changes, wherein at most one of the replicas in the replica group can act as a master replica for the replica group at a time, and wherein replicas in the replica group that are not acting as the master replica act as slave replicas in the replica group;
one of the two or more replicas attempting to assume a role of master replica for the replica group, wherein said attempting to assume the role of master replica comprises:
gathering state information from at least some of the two or more replicas other than the one of the replicas;
for each of the at least some of the two or more replicas:
determining, dependent on the state information, whether the replica supports the attempt to assume the role of master replica; and
in response to determining that the replica supports the attempt to assume the role of master replica, including the replica in a failover quorum;
in response to determining that at least a pre-determined number of replicas are included in the failover quorum, the one of the replicas:
propagating metadata indicating an impending change of mastership for the replica group to the other replicas of the replica group;
determining whether the propagation of the metadata indicating an impending change of mastership meets a pre-determined durability requirement in the replica group; and
in response to determining that the propagation of the metadata indicating an impending change of mastership meets the pre-determined durability requirement in the replica group, assuming the role of master replica for the replica group.

### Claim at position 21

21-35. (canceled)
