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

replication: allow to pass instance name as bootstrap_leader #8729

Merged

Conversation

sergepetrenko
Copy link
Collaborator

Make it possible to specify the bootstrap leader via an instance name in addition to its URI and UUID.

Closes #8539

@TarantoolBot document
Title: box.cfg.bootstrap_leader accepts instance names now

The option box.cfg.bootstrap_leader, which specifies the desired bootstrap leader when bootstrap_strategy is "config" now accepts instance names.

For example, this is a valid config without replication:

box.cfg{
    instance_name = 'main-server',
    bootstrap_strategy = 'config',
    bootstrap_leader = 'main-server'
}

When box.cfg contains some entries in replication, the node will bootstrap from whatever node which has its box.cfg.instance_name set to the same value as specified in box.cfg.bootstrap_leader.

This is an addition to tarantool/doc#3432

@sergepetrenko sergepetrenko requested a review from a team as a code owner June 1, 2023 14:05
@@ -0,0 +1,15 @@
## feature/replication

* Added ability to set `bootstrap_leader` configuration option to the instance
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Added ability to set `bootstrap_leader` configuration option to the instance
* Added the ability to set the `bootstrap_leader` configuration option to the instance

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Fixed.

@sergepetrenko sergepetrenko force-pushed the gh-8539-bootstrap-leader-name branch 3 times, most recently from e8185e7 to e0e247f Compare June 1, 2023 15:43
@coveralls
Copy link

coveralls commented Jun 1, 2023

Coverage Status

coverage: 85.776% (-0.02%) from 85.799% when pulling 6ffac11 on sergepetrenko:gh-8539-bootstrap-leader-name into 116df1d
on tarantool:master
.

@sergepetrenko sergepetrenko force-pushed the gh-8539-bootstrap-leader-name branch 2 times, most recently from 8d19685 to 6a878e7 Compare June 2, 2023 11:36
Copy link
Member

@grafin grafin left a 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! I have only two comments)

src/box/box.cc Outdated Show resolved Hide resolved
src/box/box.cc Show resolved Hide resolved
@sergepetrenko sergepetrenko force-pushed the gh-8539-bootstrap-leader-name branch from 6a878e7 to d7986d8 Compare June 6, 2023 10:39
Copy link
Member

@grafin grafin left a 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 and explanation!

Copy link
Collaborator

@Gerold103 Gerold103 left a 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!

src/box/xrow.h Outdated Show resolved Hide resolved
Node's ballot contains all the information necessary to choose it a
bootstrap leader. Since the bootstrap_leader configuration option will
allow specifying bootstrap leader's name, we have to broadcast the name
in node's ballot.

Prerequisite tarantool#8539

NO_CHANGELOG=not user-visible

@TarantoolBot document
Title: new field in node's BALLOT: IPROTO_BALLOT_INSTANCE_NAME

The node's ballot (IPROTO_BALLOT) receives a new field:
the name of the node (the same as in box.cfg.instance_name or
box.info.name):
Key: IPROTO_BALLOT_INSTANCE_NAME = 0x0a
Value: MP_STR, representing the instance name.
Make it possible to specify the bootstrap leader via an instance name in
addition to its URI and UUID.

While I'm at it, change the argument order of box_check_node_name() to
comply with box_check_uuid/uri/uri_set().

Closes tarantool#8539

@TarantoolBot document
Title: `box.cfg.bootstrap_leader` accepts instance names now

The option `box.cfg.bootstrap_leader`, which specifies the desired
bootstrap leader when bootstrap_strategy is "config" now accepts
instance names.

For example, this is a valid config without replication:
```lua
box.cfg{
    instance_name = 'main-server',
    bootstrap_strategy = 'config',
    bootstrap_leader = 'main-server'
}
```

When `box.cfg` contains some entries in `replication`, the node will
bootstrap from the node which has the instance name specified in
`box.cfg.bootstrap_leader`.

This is an addition to tarantool/doc#3432
@sergepetrenko sergepetrenko force-pushed the gh-8539-bootstrap-leader-name branch from d7986d8 to 6ffac11 Compare June 7, 2023 07:40
@Gerold103 Gerold103 self-requested a review June 7, 2023 20:14
Copy link
Collaborator

@Gerold103 Gerold103 left a 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!

@sergepetrenko sergepetrenko added the full-ci Enables all tests for a pull request label Jun 8, 2023
@sergepetrenko sergepetrenko merged commit 8ceef02 into tarantool:master Jun 8, 2023
143 checks passed
@sergepetrenko sergepetrenko deleted the gh-8539-bootstrap-leader-name branch June 8, 2023 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
full-ci Enables all tests for a pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support setting instance name (not uuid or uri) for bootstrap_leader cfg option
5 participants