Skip to content

[5pt] VShard router master discovery #2268

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

Closed
TarantoolBot opened this issue Aug 3, 2021 · 0 comments · Fixed by #2848
Closed

[5pt] VShard router master discovery #2268

TarantoolBot opened this issue Aug 3, 2021 · 0 comments · Fixed by #2848
Assignees
Labels
ecosystem [area] Task relates to Tarantool's ecosystem (connector, module, other non-server functionality) feature A new functionality vshard [area] Related to vshard module

Comments

@TarantoolBot
Copy link
Collaborator

TarantoolBot commented Aug 3, 2021

Epic: Document master discovery
Related dev issue: tarantool/vshard#75
See also tarantool/vshard@551b106

Product: Tarantool
Root document: https://www.tarantool.io/en/doc/latest/reference/reference_rock/vshard/
SME: @ Gerold103

Details

Router used not to be able to find master nodes in the configured
replicasets on its own. It relied only on how they were specified
in the config.

This becomes a problem when master changes and the change is not
delivered to the router's config somewhy. For instance, the router
does not rely on a central config provider. Or it does rely, but
the provider can't deliver a new config due to any reason.

This is getting especially tricky with built-in automatic master
elections which are not supported by vshard yet, but they will be,
they won't depend on any config. Master role won't be pinned to
one node then.

Now there is a new feature to overcome the master search problem -
configurable automatic master discovery on the router.

Router goes to the replicasets, marked as having an auto master,
finds a master in them, and periodically checks if the master is
still a master.

When a master in a replicaset stops being a master, the router
walks all nodes of the replicaset and finds who is the new master.

To turn the feature on there is a new option in router's config:
master = 'auto'. It should be specified per-replicaset, and is
not compatible with specifying a master manually.

This is how a good config looks:

config = {
    sharding = {
        <replicaset uuid> = {
            master = 'auto',
            replicas = {...},
        },
        ...
    },
    ...
}

This is how a bad config looks:

config = {
    sharding = {
        <replicaset uuid> = {
            master = 'auto',
            replicas = {
                <replica uuid1> = {
                    master = true,
                    ...
                },
                <replica uuid2> = {
                    master = false,
                    ...
                },
            },
        },
        ...
    },
    ...
}

It will not work, because either master = 'auto' can be
specified, or the master is assigned manually. Not both at the
same time.

Master discovery works in its own fiber on the router, which is
activated only if at least one replicaset is configured to look
for the master. It wakes up with a certain period. But it is
possible to wake it up on demand using
vshard.router.master_search_wakeup() function. It does not do
anything if master search is not configured for any replicaset.

Requested by @Gerold103 in tarantool/vshard@27b0f3b.

@xuniq xuniq added this to the Estimate [@xuniq] milestone Aug 23, 2021
@veod32 veod32 modified the milestones: Estimate [@xuniq], vshard doc issues Aug 27, 2021
@veod32 veod32 added ecosystem [area] Task relates to Tarantool's ecosystem (connector, module, other non-server functionality) vshard [area] Related to vshard module feature A new functionality labels Aug 27, 2021
@veod32 veod32 changed the title VShard router master discovery [5pt] VShard router master discovery Sep 1, 2021
@patiencedaur patiencedaur removed this from the vshard milestone Feb 1, 2022
@veod32 veod32 self-assigned this Apr 25, 2022
veod32 added a commit that referenced this issue Apr 27, 2022
@veod32 veod32 added 2sp and removed 5sp labels May 6, 2022
veod32 added a commit that referenced this issue May 21, 2022
patiencedaur added a commit that referenced this issue May 25, 2022
Resolves #2268 

* Add description of the `master` parameter and the `master_search_wakeup()` function

Co-authored-by: Patience Daur <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ecosystem [area] Task relates to Tarantool's ecosystem (connector, module, other non-server functionality) feature A new functionality vshard [area] Related to vshard module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants