-
Notifications
You must be signed in to change notification settings - Fork 29
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
Stateful failover #604
Stateful failover #604
Conversation
b1f5c9c
to
4e6c538
Compare
4e6c538
to
9235376
Compare
4a2746d
to
4082451
Compare
8340cfc
to
e882318
Compare
553fe0c
to
e441dee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest allowing the node to check its status and push it into membership. It may be made with some kind of callback. It may be necessary to check node replication status if this node is storage.
39d9209
to
5feabda
Compare
cartridge/topology.lua
Outdated
) | ||
|
||
local parts = uri.parse(topology.failover.coordinator_uri) | ||
local parts = uri.parse(topology.failover.storage_uri) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use pool.format_uri, something like that:
local _, err = pool.format_uri(uri)
e_config:assert(
not err,
'%s.failover.storage_uri: %s',
field, err.err
)
6692dca
to
3c3f78c
Compare
This patch introduces new failover mode - stateful.
There are 3 main concepts:
Internal coordinator is a new role, which makes decisions regarding leadership. Earlier it was a part of every instances' failover module, but now it's split away. There may be only one active coordinator in cluster at a time. Its uniqueness is ensured by external storage which manages the lock and saves appointments.
External storage (
kingdom.lua
) is a stand-alone Tarantool instance which provides locking mechanism and keeps decisions made by the coordinator.Failover module (the old one) operates on every instance in cluster and gathers leadership information for others modules. It was refactored too, and now it can be described with 4 functions with clearly separated responsibilities:
_get_appointments_*
generates leadership map by itself or polls it from external storage depending on the mode setting (disabled/eventual/stateful).accept_appointments()
just refreshes the cache and tracks if anything changed.failover_loop
(a fiber) repeatedly gets new appointments and accepts them using corresponding functions from the above.cfg
is called fromconfapplier.apply_config()
(on restart or on committing new clusterwide configuration). At first it gets appointments synchronously and then starts the failover loop.I didn't forget about
Close #148