Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failover: add failover priority replica option #478

Conversation

georgiy-belyanin
Copy link
Member

Add the failover_priority config option in the] sharding.<replicaset_id>.replicas.<replica_id> section.

Using the option you may specify the order failover will connect to the replicas. The lower the value, the higher the priority of the replica.

@georgiy-belyanin
Copy link
Member Author

Instead of the extra failover configuration section I've implemented an approach with the extra optional shading replica configuration property.

return {
    sharding = {
        ['cbf06940-0790-498b-948d-042b62cf3d29'] = {
            replicas = {
                ['8a274925-a26d-47fc-9e1b-af88ce939412'] = {
                    name = 'storage_1_a',
                    master = true,
                    failover_priority = 1
                },
                ['3de2e3e1-9ebe-4d0d-abb1-26d301b84633'] = {
                    name = 'storage_1_b',
                    failover_priority = 2
                },
                ['001688c3-66f8-4a31-8e19-036c17d489c2'] = {
                    name = 'storage_1_c',
                    failover_priority = 3
                }
            },
        }
    }
}

In my opinion it's better not to manage with the duplicates of the replica sets and replicas UUIDs and to specify the failover priorities near the definition.

Also I haven't found the corresponding issue yet.

Add the `failover_priority` config option in the
`sharding.<replicaset_id>.replicas.<replica_id>` section.

Using the option you may specify the order failover will connect to the
replicas. The lower the value, the higher the priority of the replica.

The current replica priority: `replica's failover priority > weight
of the replica's zone > is replica a master > order in the sharding
configuration`.

@TarantoolBot document
title: failover priority per-replica option
Now you can specify failover priority for the replica using the
`failover_priority` property when descriping replicas in sharding
section. The lower the value, the higher the priority of the replica.

The failover will try to select an available replica with the highest
priority out of all.

Example:
```lua
sharding = {
    ['cbf06940-0790-498b-948d-042b62cf3d29'] = {
        replicas = {
            ['8a274925-a26d-47fc-9e1b-af88ce939412'] = {
                master = true,
                failover_priority = 1
            },
            ['3de2e3e1-9ebe-4d0d-abb1-26d301b84633'] = {
                failover_priority = 3
            },
            ['001688c3-66f8-4a31-8e19-036c17d489c2'] = {
                failover_priority = 2
            }
        },
    }
}
```
The config specifies three replicas. By default the master will be used.
If it stops working failover will select `001688c3-...` as a new
replica.

To calculate the replica priority in case of the equal
`failover_priority` values. with the same values of the properties the
following heuristics are used:
* The replica's failover priority.
* The weight of the replica's zone.
* The master status of the replica.
* The order of the replicas in the sharding configuration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant