-
Notifications
You must be signed in to change notification settings - Fork 33
Introduce named config #451
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
Introduce named config #451
Conversation
3e18c69
to
172a79c
Compare
172a79c
to
ad6a3de
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.
Thanks for the patch, good stuff!
4d4f984
to
ecdda47
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.
Thanks for the fixes!
ecdda47
to
22c8cb3
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.
Thanks for the fixes!
This commit allows vtest to create named config, wich will be introduced in the following commits. If identification_mode is 'name_as_key', then names are used instead of UUIDs as keys, replica/replicaset.name is not specified, as it's forbidden, UUIDs are set as replica/replicaset.uuid. The commit also introduces new server API: instance/replicaset_name(), which is meant to be used in tests for Tarantool >= 3.0.0. Part of tarantool#426 NO_DOC=internal
In the following commits it'll be allowed to use names instead of UUIDs. This patch refactors error module, changing the name of arguments, accepted by errors: from now on it may be either UUID or persistent name, so we cannot say, that this is always UUID, as it's done now. The alternative would be to rename arguments according to the configuration used on the fly. It's not selected, as it complicates expluatation. Note, that this is breaking change, if user's code relies on UUID arguments of returned errors! Part of tarantool#426 NO_DOC=refactoring
This commit replaces all appearances of UUIDs in replicaset's code, where it's possible to do without any functional changes. This commit has only code-readability purpose, as in the future named identification will be introduced. Part of tarantool#426 NO_DOC=refactoring NO_TEST=refactoring
From now on keys inside replicaset and replicaset.replicas may be either replicaset/instance_name or UUID, depending on cfg.identification_mode. We cannot use UUIDs always now, as they might not be specified at all. Part of tarantool#426 NO_DOC=internal
Part of tarantool#426 @TarantoolBot document Title: vshard: config identification mode The option `identification_mode` should be specified in the root of the config. It can have one of those values: * `'uuid_as_key'` - default. Means, that default uuid config identification is used. replica.name is allowed and should not be interpreted as `box.cfg.instance_name`. replica/replicaset.uuid is forbidden. The config should have the following format: ``` { ['cbf06940-0790-498b-948d-042b62cf3d29'] = { -- replicaset tarantool#1 replicas = { ['8a274925-a26d-47fc-9e1b-af88ce939412'] = { name = 'storage_1_a', ... }, ... }, }, ... } ``` * `'name_as_key'`. Name identification is used, supported only by Tarantool >= 3.0.0. It's forbidden to specify replica.name in such format. UUIDs are optional and can be specified via replicaset/replica.uuid: ``` { replicaset_1 = { uuid = 'cbf06940-0790-498b-948d-042b62cf3d29', replicas = { replica_1_a = { uuid = '8a274925-a26d-47fc-9e1b-af88ce939412' ... }, ... } }, ... } ``` Note, that names, used as keys in config are passed to box.cfg.replicaset/instance_name for storage. In case of reconfiguration it's strictly validated, that both replicaset and instance name corresponds to the passed config. Vshard doesn't deal with changing or setting names, it must be done externally (using Tarantool's config module, for example).
This commit replaces all appearances of UUIDs in storage's code, where it's possible to do without any functional changes. This commit has only code-readability purpose, as in the future named identification will be introduced. Part of tarantool#426 NO_DOC=refactoring NO_TEST=refactoring
22c8cb3
to
c1b8814
Compare
This commit allows storage to use named config identification. Part of tarantool#426 @TarantoolBot document Title: vshard: vshard.storage.cfg argument change vshard.storage.cfg(cfg, instance_id) Configure the database and start sharding for the specified storage instance. `istance_id` depends on `identification_mode` used in config. If it's 'uuid_as_key', which is default, then UUID must be used. Otherwise - instance_name. Parameters: cfg – a storage configuration instance_id – UUID or name of the instance
When named config is used, there may be no UUIDs specified for replicas and replicasets. Consequently, in such case we must also show the names in addition to UUIDs in storage.info(). Part of tarantool#426 @TarantoolBot document Title: vshard: vshard.storage.info shows name When `identification_mode` is `name_as_key`, persisted master and replicaset name is shown in vshard.storage.info: ``` tarantool> vshard.storage.info() --- - replicasets: replicaset_1: name: replicaset_1 master: uri: admin@localhost:3302 name: replica_1_a ... ```
This commit replaces all appearances of UUIDs in router's code, where it's possible to do without any functional changes. This commit has only code-readability purpose, as in the future named identification will be introduced. Part of tarantool#426 NO_DOC=refactoring NO_TEST=refactoring
This commit allows router to use named config identification. Part of tarantool#426 NO_DOC=<no API changed>
When named config is used, there may be no UUIDs specified for replicas. Consequently, in such case we must also show the name of replica, where bucket is located, not only UUID. Part of tarantool#426 @TarantoolBot document Title: vshard: vshard.router.buckets_info shows name When `identification_mode` is `name_as_key`, buckets_info() also returns name of the replicas, where buckets are stored: ``` tarantool> vshard.router.buckets_info() --- - - uuid: aaaaaaaa-0000-4000-a000-000000000000 status: available_rw name: replica_1_a ```
When named config is used, there may be no UUIDs specified for replicas and replicasets. Consequently, in such case we must also show the names in addition to UUIDs in router.info(). Part of tarantool#426 @TarantoolBot document Title: vshard: vshard.router.info shows name When `identification_mode` is `name_as_key`, persisted master and replicaset name is shown in vshard.router.info: ``` tarantool> vshard.router.info() --- - replicasets: replicaset_1: replica: &0 network_timeout: 0.5 status: available uri: storage@127.0.0.1:3303 name: replica_1_a name: replicaset_1 master: *0 ```
It's needed to check, whether the error was a timeout or not in the following commit. Let's move this function from vtest to error module. Needed for tarantool#426 NO_DOC=internal
a9b2a55
to
7faf610
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.
Thanks for the fixes!
7faf610
to
106a081
Compare
106a081
to
abf6c93
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.
Thanks for the fixes! We are on the finish line.
In case of name identification, no UUID may be passed at all, so we cannot verify only UUID, when connecting to storage. It seems impossible to extend the current net.box greeting by exposing net_box.conn.name to it, as iproto greeting doesn't have enough free space to save 64 bit instance name. So, we should deal with name validation on vshard side. For this, conn.vconnect is introduced. It's asynchronous vshard greeting, saved inside netbox connection. It stores future object and additional info, needed for its work. Future is initialized, when the connection is established (inside netbox_on_connect). The connection cannot be considered "connected" until vconnect is properly validated. Currently only instance_name is validated inside conn.vconnect. Closes tarantool#426 NO_DOC=internal
abf6c93
to
8fda4eb
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.
Thanks for the fixes!
This patchset allows using names instead of UUIDs on storage and router. This blocks config module from dropping UUIDs in favor of names.
Closes #426