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

Allow to set instance/replicaset/cluster names on recovery at first box.cfg #8978

Closed
Gerold103 opened this issue Aug 11, 2023 · 0 comments · Fixed by #9255
Closed

Allow to set instance/replicaset/cluster names on recovery at first box.cfg #8978

Gerold103 opened this issue Aug 11, 2023 · 0 comments · Fixed by #9255
Assignees
Labels
3.0 Target is 3.0 and all newer release/master branches feature A new functionality replication

Comments

@Gerold103
Copy link
Collaborator

The names are supposed to be set on instance bootstrap and never change. However this is problematic when it comes to setting them first time on already existing instances which were upgraded to >= 3.0.

Right now those instances have to be started without names, then the names have to be set in a non-first box.cfg{}.

Apparently it is not enough and people want to set them first time on first box.cfg{} on recovery.

There is no an easy way to do that. The problems are on read-only instances:

  • They can't set replicaset and cluster names. So such box.cfg{} with new names would fair or hang, no other options.
  • Instance name can't be set because the instance have to wait for the master to register the new name for this instance. The waiting might contradict with options like replication_sync_timeout.

Besides, if there are multiple read-write instances, it is not clear what happens if they all set replicaset and cluster names.

The solution approved by PMs is this: if force_recovery is set and at least one stored name doesn't match the name in the config, then try to fix them. box.cfg{} will hang until the instance becomes writable. The writable instance persists new replicaset and cluster names, and own instance name. The read-only instances have to wait until the writeable one sets the new names. For the instance name they will have to retry their IPROTO_REGISTER request until they get the new name. The timeout for this waiting could be something like replication_timeout x 4 or replication_connect_timeout or something. That isn't too important, up to the implementation.

This should only work if there was no old name at all (i.e. it was NULL). Otherwise the behaviour remains like now.

@Gerold103 Gerold103 added feature A new functionality replication labels Aug 11, 2023
@Gerold103 Gerold103 self-assigned this Aug 11, 2023
@Serpentian Serpentian assigned Serpentian and unassigned Gerold103 Sep 27, 2023
Serpentian added a commit to Serpentian/tarantool that referenced this issue Sep 27, 2023
Currently it's impossible to recover from the snapshot, which doesn't
have names set in it. This makes upgrading to 3.0.0 difficult and
requires starting Tarantool manually in interactive mode, invoking
box.cfg without names, upgrading schema and setting names manually.

We need to make Tarantool set names automatically, when it's configured
via yaml file. Even with invoking box.cfg two times (without names and
with them) it's impossible to set names before the time, schema is
upgraded. But we consider schema auto-upgrade unacceptable and expect
from users to do it, when they're ready.

So, let's allow setting names in box.cfg on the first configuration
and recover from snaps, which don't have names set. As we cannot apply
such names before schema upgrade, setting names on schema version below
3.0.0 has no effect.

Needed for tarantool#8978

NO_DOC=tarantool/doc#3661
Serpentian added a commit to Serpentian/tarantool that referenced this issue Sep 27, 2023
This commit moves all code, related to working with versions and which
was used in box/lua/upgrade.lua, into a separate module and exports it
to Lua API as 'internal.version'

This is needed, as in the following commit we start to broadcast the
dd_version_id variable, which shows the version of schema, stored in
_schema['version']. This module allows us to write a trigger for
config module and avoid code duplication.

Needed for tarantool#8978

NO_DOC=internal
NO_TEST=<already tested>
NO_CHANGELOG=internal
Serpentian added a commit to Serpentian/tarantool that referenced this issue Sep 27, 2023
This commit starts to broadcast dd_version_id, which will be used
to write a trigger, which will be run on schema upgrade. We cannot
use on_replace/on_commit triggers for that, as it's either forbidden
or not safe to yield in them. Moreover, on_replace trigger forbids
making DDL changes in it.

Needed for tarantool#8978

NO_TEST=<in the following commit>

@TarantoolBot document
Title: broadcast dd_version_id in box.schema event

One new field have been added to box.schema system event: dd_version_id,
which is represented as bit mask. Use 'internal.mkversion' to get more
convenient way of version representation:

```
tarantool> mkversion = require('internal.mkversion')
---
...

tarantool> version = mkversion.from_id(dd_version_id)
---
...

tarantool> version
---
- patch: 0
  minor: 0
  id: 196608
  major: 3
...
```
Serpentian added a commit to Serpentian/tarantool that referenced this issue Sep 27, 2023
This commit adds a trigger, which sets names via box.cfg, when
dd_version_id, seen from box.schema event, is changed to the
version >= 3.0.0 from version < 3.0.0.

On master instances we set replicaset_name and instance_name.
On replicas - only instance_name, they'll automatically register
themselves in _cluster space by making IPROTO_REGISTER
to master. This behavior allows live upgrade to Tarantool 3.0.0.

Closes tarantool#8978

NO_DOC=tarantool/doc#3661
Serpentian added a commit to Serpentian/tarantool that referenced this issue Sep 27, 2023
Currently it's impossible to recover from the snapshot, which doesn't
have names set in it. This makes upgrading to 3.0.0 difficult and
requires starting Tarantool manually in interactive mode, invoking
box.cfg without names, upgrading schema and setting names manually.

We need to make Tarantool set names automatically, when it's configured
via yaml file. Even with invoking box.cfg two times (without names and
with them) it's impossible to set names before the time, schema is
upgraded. But we consider schema auto-upgrade unacceptable and expect
from users to do it, when they're ready.

So, let's allow setting names in box.cfg on the first configuration
and recover from snaps, which don't have names set. As we cannot apply
such names before schema upgrade, setting names on schema version below
3.0.0 has no effect.

Needed for tarantool#8978

NO_DOC=tarantool/doc#3661
Serpentian added a commit to Serpentian/tarantool that referenced this issue Sep 27, 2023
This commit moves all code, related to working with versions and which
was used in box/lua/upgrade.lua, into a separate module and exports it
to Lua API as 'internal.version'

This is needed, as in the following commit we start to broadcast the
dd_version_id variable, which shows the version of schema, stored in
_schema['version']. This module allows us to write a trigger for
config module and avoid code duplication.

Needed for tarantool#8978

NO_DOC=internal
NO_TEST=<already tested>
NO_CHANGELOG=internal
Serpentian added a commit to Serpentian/tarantool that referenced this issue Sep 27, 2023
This commit starts to broadcast dd_version_id, which will be used
to write a trigger, which will be run on schema upgrade. We cannot
use on_replace/on_commit triggers for that, as it's either forbidden
or not safe to yield in them. Moreover, on_replace trigger forbids
making DDL changes in it.

Needed for tarantool#8978

NO_TEST=<in the following commit>

@TarantoolBot document
Title: broadcast dd_version_id in box.schema event

One new field have been added to box.schema system event: dd_version_id,
which is represented as bit mask. Use 'internal.mkversion' to get more
convenient way of version representation:

```
tarantool> mkversion = require('internal.mkversion')
---
...

tarantool> version = mkversion.from_id(dd_version_id)
---
...

tarantool> version
---
- patch: 0
  minor: 0
  id: 196608
  major: 3
...
```
Serpentian added a commit to Serpentian/tarantool that referenced this issue Sep 27, 2023
This commit adds a trigger, which sets names via box.cfg, when
dd_version_id, seen from box.schema event, is changed to the
version >= 3.0.0 from version < 3.0.0.

On master instances we set replicaset_name and instance_name.
On replicas - only instance_name, they'll automatically register
themselves in _cluster space by making IPROTO_REGISTER to master.
This behavior allows live upgrade to Tarantool 3.0.0.

Closes tarantool#8978

NO_DOC=tarantool/doc#3661
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 12, 2023
Config's box.cfg applier scans snapshot_dir in order to find out,
whether recovery is going to be done. It's needed in order to determine,
whether the instance should be started into ro mode firstly.

Let's move info about snapshot into configdata, as it accumulates
configuration data and this part should be there. The commit also
introduces snapshot_path, which will be used in the following commits
in order to validate names.

Needed for tarantool#8978

NO_DOC=refactoring
NO_TEST=refactoring
NO_CHANGELOG=refactoring
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 12, 2023
This commit introduces the new method for xlog module: xlog.meta().
It opens an xlog file, reads and returns the meta block of the file,
which includes its filetype, instance_uuid and vclocks.

It's needed in order to introduce names cheking in the following
commit.

@TarantoolBot document
Title: xlog.meta([file-name]) method

Description: Open an xlog file, and return its meta block.
Possible errors: File does not contain properly formatted snapshot
or write-ahead-log information.

Needed for tarantool#8978

Example:

```lua
tarantool> xlog = require('xlog')
---
...

tarantool> xlog.meta('00000000000000000000.snap')
---
- filetype: SNAP
  prev_vclock: {}
  instance_uuid: 87b2e60f-275c-4efa-9b0e-e9562e309692
  vclock: {}
...
```
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 12, 2023
Currently only instance_uuid is validated before recovery process.
All names and replicaset_uuid are checked only when recovery is done,
which can take a long time. It can be frustrating to users, which
have been waiting for several hours only to get name mismatch error.

Let's read the small part of snapshot file before calling box.cfg
in order to figure out, whether the names and uuids, passed to
configuration match the ones, saved inside the snapshot. Let's also
save all names, which are missing from snapshot in order to set them
automatically in the future.

Needed for tarantool#8978

NO_DOC=tarantool/doc#3661
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 12, 2023
For now it's impossible to drop created alert in any way except
manual searching for _alerts table. However, we need to drop alerts
on missing names, when the names are set.

Let's introduce simple key-value alerts in order to easily drop them
by key.

Needed for tarantool#8978

NO_DOC=internal
NO_TEST=following commit
NO_CHANGELOG=internal
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 12, 2023
For now it's impossible to use config module in order to recover
from snaps, which don't have names set in them. Calling box.cfg
with names on recovery fails with MISMATCH error, which is caused
by difficult implementation of setting names on first box.cfg,
as names can be set only on rw instance.

This commit doesn't call box.cfg with names, if these names are
missing from the snapshot file. Instead it creates a fiber, which
will set names, when it's possible to do so. Only master sets the
names for the whole cluster.

Closes tarantool#8978

NO_DOC=tarantool/doc#3661
NO_CHANGELOG=following commits
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 12, 2023
This commit moves all code, related to working with versions and which
was used in box/lua/upgrade.lua, into a separate module and exports it
to Lua API as 'internal.version'

This is needed, as in the following commit we set names automatically
only when schema version is more than 3.0.0. This module is used their
in order to avoid code duplication.

Follow-up tarantool#8978

NO_DOC=internal
NO_TEST=<already tested>
NO_CHANGELOG=internal
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 12, 2023
It's impossible to set names on Tarantool below 3.0.0, as all DDL
is forbidden before schema upgrade.

Let's make names NoOp on schema below Tarantool 3.0.0 and set names
automatically only schema upgrade is done.

Follow-up tarantool#8978

NO_DOC=tarantool/doc#3661
NO_CHANGELOG=following commits
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 12, 2023
This commit introduces the new method for xlog module: xlog.meta().
It opens an xlog file, reads and returns the meta block of the file,
which includes its filetype, instance_uuid and vclocks.

It's needed in order to introduce names checking in the following
commit.

@TarantoolBot document
Title: xlog.meta([file-name]) method

Description: Open an xlog file, and return its meta block.
Possible errors: File does not contain properly formatted snapshot
or write-ahead-log information.

Needed for tarantool#8978

Example:

```lua
tarantool> xlog = require('xlog')
---
...

tarantool> xlog.meta('00000000000000000000.snap')
---
- filetype: SNAP
  prev_vclock: {}
  instance_uuid: 87b2e60f-275c-4efa-9b0e-e9562e309692
  vclock: {}
...
```
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 12, 2023
Currently only instance_uuid is validated before recovery process.
All names and replicaset_uuid are checked only when recovery is done,
which can take a long time. It can be frustrating to users, which
have been waiting for several hours only to get name mismatch error.

Let's read the small part of snapshot file before calling box.cfg
in order to figure out, whether the names and uuids, passed to
configuration match the ones, saved inside the snapshot. Let's also
save all names, which are missing from snapshot in order to set them
automatically in the future.

Needed for tarantool#8978

NO_DOC=tarantool/doc#3661
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 12, 2023
For now it's impossible to drop created alert in any way except
manual searching for _alerts table. However, we need to drop alerts
on missing names, when the names are set.

Let's introduce simple key-value alerts in order to easily drop them
by key.

Needed for tarantool#8978

NO_DOC=internal
NO_TEST=following commit
NO_CHANGELOG=internal
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 12, 2023
For now it's impossible to use config module in order to recover
from snaps, which don't have names set in them. Calling box.cfg
with names on recovery fails with MISMATCH error, which is caused
by difficult implementation of setting names on first box.cfg,
as names can be set only on rw instance.

This commit doesn't call box.cfg with names, if these names are
missing from the snapshot file. Instead it creates a fiber, which
will set names, when it's possible to do so. Only master sets the
names for the whole cluster.

Closes tarantool#8978

NO_DOC=tarantool/doc#3661
NO_CHANGELOG=following commits
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 12, 2023
This commit moves all code, related to working with versions and which
was used in box/lua/upgrade.lua, into a separate module and exports it
to Lua API as 'internal.version'

This is needed, as in the following commit we set names automatically
only when schema version is more than 3.0.0. This module is used their
in order to avoid code duplication.

Follow-up tarantool#8978

NO_DOC=internal
NO_TEST=<already tested>
NO_CHANGELOG=internal
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 12, 2023
It's impossible to set names on Tarantool below 3.0.0, as all DDL
is forbidden before schema upgrade.

Let's make names NoOp on schema below Tarantool 3.0.0 and set names
automatically only schema upgrade is done.

Follow-up tarantool#8978

NO_DOC=tarantool/doc#3661
NO_CHANGELOG=following commits
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 12, 2023
For now it's impossible to use config module in order to recover
from snaps, which don't have names set in them. Calling box.cfg
with names on recovery fails with MISMATCH error, which is caused
by difficult implementation of setting names on first box.cfg,
as names can be set only on rw instance.

This commit doesn't call box.cfg with names, if these names are
missing from the snapshot file. Instead it creates a fiber, which
will set names, when it's possible to do so. Only master sets the
names for the whole cluster.

Closes tarantool#8978

NO_DOC=tarantool/doc#3661
NO_CHANGELOG=following commits
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 12, 2023
This commit moves all code, related to working with versions and which
was used in box/lua/upgrade.lua, into a separate module and exports it
to Lua API as 'internal.version'

This is needed, as in the following commit we set names automatically
only when schema version is more than 3.0.0. This module is used their
in order to avoid code duplication.

Follow-up tarantool#8978

NO_DOC=internal
NO_TEST=<already tested>
NO_CHANGELOG=internal
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 26, 2023
When the name is manually set on master by replace in _cluster space,
calling box.cfg on replica with the same name causes its hang. The
problem is the fact, that resubscribe is initiated and waiting for
APPLIER_REGISTERED status is started. As applier knows, that no
registration should be done, this never happens.

Let's don't initiate registration, when instance name is already set.

Needed for tarantool#8978

NO_DOC=bugfix
NO_CHANGELOG=not released yet
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 26, 2023
For now it's impossible to use config module in order to recover
from snaps, which don't have names set in them. Calling box.cfg
with names on recovery fails with MISMATCH error, which is caused
by difficult implementation of setting names on first box.cfg,
as names can be set only on rw instance.

This commit doesn't call box.cfg with names, if these names are
missing from the snapshot file. Instead it creates a fiber, which
will set names, when it's possible to do so. Only master sets the
names for the whole cluster.

Closes tarantool#8978

NO_DOC=tarantool/doc#3661
NO_CHANGELOG=following commits
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 26, 2023
This commit moves all code, related to working with versions and which
was used in box/lua/upgrade.lua, into a separate module and exports it
to Lua API as 'internal.version'

This is needed, as in the following commit we set names automatically
only when schema version is more than 3.0.0. This module is used their
in order to avoid code duplication.

Follow-up tarantool#8978

NO_DOC=internal
NO_TEST=<already tested>
NO_CHANGELOG=internal
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 26, 2023
It's impossible to set names on Tarantool below 3.0.0, as all DDL
is forbidden before schema upgrade.

Let's make names NoOp on schema below Tarantool 3.0.0 and set names
automatically only when schema upgrade is done.

Follow-up tarantool#8978

NO_DOC=tarantool/doc#3661
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 26, 2023
Currently only instance_uuid is validated before recovery process.
All names and replicaset_uuid are checked only when recovery is done,
which can take a long time. It can be frustrating to users, which
have been waiting for several hours only to get name mismatch error.

Let's read the small part of snapshot file before calling box.cfg
in order to figure out, whether the names and uuids, passed to
configuration match the ones, saved inside the snapshot.

During config reload there's no sense in reading snapshot file, as
data is already saved inside spaces, let's read them. We still check
that names in config and names in spaces don't contradict during
config reload.

This commit also introduces methods, for getting names, which are
not set in snap (or memory), this'll be used in consequent commits
to set names automatically.

Needed for tarantool#8978

NO_DOC=tarantool/doc#3661
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 26, 2023
For now it's impossible to drop created alert in any way except
manual searching for _alerts table. However, we need to drop alerts
on missing names, when the names are set.

Let's introduce simple key-value alerts in order to easily drop them
by key.

Needed for tarantool#8978

NO_DOC=internal
NO_TEST=following commit
NO_CHANGELOG=internal
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 26, 2023
When the name is manually set on master by replace in _cluster space,
calling box.cfg on replica with the same name causes its hang. The
problem is the fact, that resubscribe is initiated and waiting for
APPLIER_REGISTERED status is started. As applier knows, that no
registration should be done, this never happens.

Let's don't initiate registration, when instance name is already set.

Needed for tarantool#8978

NO_DOC=bugfix
NO_CHANGELOG=not released yet
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 26, 2023
For now it's impossible to use config module in order to recover
from snaps, which don't have names set in them. Calling box.cfg
with names on recovery fails with MISMATCH error, which is caused
by difficult implementation of setting names on first box.cfg,
as names can be set only on rw instance.

This commit doesn't call box.cfg with names, if these names are
missing from the snapshot file. Instead it creates a fiber, which
will set names, when it's possible to do so. Only master sets the
names for the whole cluster.

Closes tarantool#8978

NO_DOC=tarantool/doc#3661
NO_CHANGELOG=following commits
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 26, 2023
This commit moves all code, related to working with versions and which
was used in box/lua/upgrade.lua, into a separate module and exports it
to Lua API as 'internal.version'

This is needed, as in the following commit we set names automatically
only when schema version is more than 3.0.0. This module is used their
in order to avoid code duplication.

Follow-up tarantool#8978

NO_DOC=internal
NO_TEST=<already tested>
NO_CHANGELOG=internal
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 26, 2023
It's impossible to set names on Tarantool below 3.0.0, as all DDL
is forbidden before schema upgrade.

Let's make names NoOp on schema below Tarantool 3.0.0 and set names
automatically only when schema upgrade is done.

Follow-up tarantool#8978

NO_DOC=tarantool/doc#3661
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 26, 2023
It's impossible to set names on Tarantool below 3.0.0, as all DDL
is forbidden before schema upgrade.

Let's make names NoOp on schema below Tarantool 3.0.0 and set names
automatically only when schema upgrade is done.

Follow-up tarantool#8978

NO_DOC=tarantool/doc#3661
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 26, 2023
For now it's impossible to use config module in order to recover
from snaps, which don't have names set in them. Calling box.cfg
with names on recovery fails with MISMATCH error, which is caused
by difficult implementation of setting names on first box.cfg,
as names can be set only on rw instance.

This commit doesn't call box.cfg with names, if these names are
missing from the snapshot file. Instead it creates a fiber, which
will set names, when it's possible to do so. Only master sets the
names for the whole cluster.

Closes tarantool#8978

NO_DOC=tarantool/doc#3661
NO_CHANGELOG=following commits
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 26, 2023
This commit moves all code, related to working with versions and which
was used in box/lua/upgrade.lua, into a separate module and exports it
to Lua API as 'internal.version'

This is needed, as in the following commit we set names automatically
only when schema version is more than 3.0.0. This module is used their
in order to avoid code duplication.

Follow-up tarantool#8978

NO_DOC=internal
NO_TEST=<already tested>
NO_CHANGELOG=internal
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 26, 2023
It's impossible to set names on Tarantool below 3.0.0, as all DDL
is forbidden before schema upgrade.

Let's make names NoOp on schema below Tarantool 3.0.0 and set names
automatically only when schema upgrade is done.

Follow-up tarantool#8978

NO_DOC=tarantool/doc#3661
@sergepetrenko sergepetrenko added the 3.0 Target is 3.0 and all newer release/master branches label Oct 27, 2023
sergepetrenko pushed a commit that referenced this issue Oct 27, 2023
Config's box.cfg applier scans snapshot_dir in order to find out,
whether recovery is going to be done. It's needed in order to determine,
whether the instance should be started into ro mode firstly.

Let's move info about snapshot into separate file in utils. The commit
also introduces snapshot_path, which will be used in the following
commits in order to validate names.

Needed for #8978

NO_DOC=refactoring
NO_TEST=refactoring
NO_CHANGELOG=refactoring
sergepetrenko pushed a commit that referenced this issue Oct 27, 2023
This commit introduces the new method for xlog module: xlog.meta().
It opens an xlog file, reads and returns the meta block of the file,
which includes its filetype, instance_uuid and vclocks.

It's needed in order to introduce checking of names inside the config
module in the following commit.

Needed for #8978

@TarantoolBot document
Title: xlog.meta(file-name) method

Description: Open an xlog file, and return its meta block.
Possible errors: Failed to open a file or it does not contain properly
formatted meta block.

Example:

```lua
tarantool> xlog = require('xlog')
---
...

tarantool> xlog.meta('00000000000000000000.snap')
---
- filetype: SNAP
  prev_vclock: {}
  instance_uuid: 87b2e60f-275c-4efa-9b0e-e9562e309692
  vclock: {}
...
```
sergepetrenko pushed a commit that referenced this issue Oct 27, 2023
box.schema has a number of constants, e.g. IDs of system spaces,
which may be useful for the user. Let's allow to access box.schema
before box.cfg is called.

It is used in checking names, as we need to know, which snapshot spaces
to scan.

Needed for #8978

NO_DOC=minor change
sergepetrenko pushed a commit that referenced this issue Oct 27, 2023
Currently only instance_uuid is validated before recovery process.
All names and replicaset_uuid are checked only when recovery is done,
which can take a long time. It can be frustrating to users, which
have been waiting for several hours only to get name mismatch error.

Let's read the small part of snapshot file before calling box.cfg
in order to figure out, whether the names and uuids, passed to
configuration match the ones, saved inside the snapshot.

During config reload there's no sense in reading snapshot file, as
data is already saved inside spaces, let's read them. We still check
that names in config and names in spaces don't contradict during
config reload.

This commit also introduces methods, for getting names, which are
not set in snap (or memory), this'll be used in consequent commits
to set names automatically.

Needed for #8978

NO_DOC=tarantool/doc#3661
sergepetrenko pushed a commit that referenced this issue Oct 27, 2023
For now it's impossible to drop created alert in any way except
manual searching for _alerts table. However, we need to drop alerts
on missing names, when the names are set.

Let's introduce simple key-value alerts in order to easily drop them
by key.

Needed for #8978

NO_DOC=internal
NO_TEST=following commit
NO_CHANGELOG=internal
sergepetrenko pushed a commit that referenced this issue Oct 27, 2023
When the name is manually set on master by replace in _cluster space,
calling box.cfg on replica with the same name causes its hang. The
problem is the fact, that resubscribe is initiated and waiting for
APPLIER_REGISTERED status is started. As applier knows, that no
registration should be done, this never happens.

Let's don't initiate registration, when instance name is already set.

Needed for #8978

NO_DOC=bugfix
NO_CHANGELOG=not released yet
sergepetrenko pushed a commit that referenced this issue Oct 27, 2023
For now it's impossible to use config module in order to recover
from snaps, which don't have names set in them. Calling box.cfg
with names on recovery fails with MISMATCH error, which is caused
by difficult implementation of setting names on first box.cfg,
as names can be set only on rw instance.

This commit doesn't call box.cfg with names, if these names are
missing from the snapshot file. Instead it creates a fiber, which
will set names, when it's possible to do so. Only master sets the
names for the whole cluster.

Closes #8978

NO_DOC=tarantool/doc#3661
NO_CHANGELOG=following commits
sergepetrenko pushed a commit that referenced this issue Oct 27, 2023
This commit moves all code, related to working with versions and which
was used in box/lua/upgrade.lua, into a separate module and exports it
to Lua API as 'internal.version'

This is needed, as in the following commit we set names automatically
only when schema version is more than 3.0.0. This module is used their
in order to avoid code duplication.

Follow-up #8978

NO_DOC=internal
NO_TEST=<already tested>
NO_CHANGELOG=internal
sergepetrenko pushed a commit that referenced this issue Oct 27, 2023
It's impossible to set names on Tarantool below 3.0.0, as all DDL
is forbidden before schema upgrade.

Let's make names NoOp on schema below Tarantool 3.0.0 and set names
automatically only when schema upgrade is done.

Follow-up #8978

NO_DOC=tarantool/doc#3661
Serpentian added a commit to Serpentian/tarantool that referenced this issue Oct 27, 2023
At the last itaration of review it was decided to throw an alerts,
when no UUID was passed to config and name is not set in _cluster.

This leads to alerts, thrown during replicaset bootstrap. However,
_cluster:on_replace trigger wasn't updated for that change, it
asssumed that when insert of a new replica is done, no alerts was
thrown.

Let's fix the behavior of on_replace trigger so that it deletes
alerts as soon as replica joined with name.

Follow-up tarantool#8978

NO_DOC=bugfix
NO_TEST=<already tested>
NO_CHANGELOG=bugfix
Totktonada pushed a commit that referenced this issue Oct 27, 2023
At the last itaration of review it was decided to throw an alerts,
when no UUID was passed to config and name is not set in _cluster.

This leads to alerts, thrown during replicaset bootstrap. However,
_cluster:on_replace trigger wasn't updated for that change, it
asssumed that when insert of a new replica is done, no alerts was
thrown.

Let's fix the behavior of on_replace trigger so that it deletes
alerts as soon as replica joined with name.

Follow-up #8978

NO_DOC=bugfix
NO_TEST=<already tested>
NO_CHANGELOG=bugfix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.0 Target is 3.0 and all newer release/master branches feature A new functionality replication
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants