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

tt replicaset: add subcommand downgrade #1031

Merged

Conversation

mandesero
Copy link
Contributor

@mandesero mandesero commented Nov 22, 2024

The tt replicaset downgrade command works similarly to tt replicaset upgrade (see tarantool/doc#4641, tarantool/doc#4661) but requires specifying a target version for the downgrade and uses box.schema.downgrade(<..version..>) instead of box.schema.upgrade().

The version must be provided using the --version (or -v) option in the x.x.x format, where x represents a numerical value.

Usage Example:

$ tt replicaset downgrade [<APP_NAME> | <URI>] --version 3.0.0

Note:

Can only be used with tarantool >= 2.11.

The 2.11 version provides the ability to downgrade a database to the specified Tarantool version using the box.schema.downgrade() method. This might be useful in the case of a failed upgrade.

(see https://www.tarantool.io/ru/doc/latest/release/2.11.0/#downgrading-a-database).


Closes #968

@mandesero
Copy link
Contributor Author

Waiting for #1030

@mandesero mandesero added the blocked Not ready to be implemented label Nov 22, 2024
@mandesero mandesero force-pushed the mandesero/gh-968-tt-downgrade branch 6 times, most recently from d6271d0 to b53f850 Compare November 27, 2024 12:11
@oleg-jukovec oleg-jukovec removed the blocked Not ready to be implemented label Nov 27, 2024
@mandesero mandesero force-pushed the mandesero/gh-968-tt-downgrade branch 2 times, most recently from b5b4952 to 5b44826 Compare November 27, 2024 12:53
@mandesero mandesero marked this pull request as ready for review November 27, 2024 13:00
@oleg-jukovec
Copy link
Contributor

Please, rebase on the master branch.

CHANGELOG.md Outdated Show resolved Hide resolved
cli/replicaset/cmd/downgrade.go Outdated Show resolved Hide resolved
cli/replicaset/cmd/downgrade.go Outdated Show resolved Hide resolved
cli/replicaset/cmd/downgrade.go Outdated Show resolved Hide resolved
@mandesero mandesero force-pushed the mandesero/gh-968-tt-downgrade branch 2 times, most recently from 0bce39e to 8a3a4b7 Compare November 28, 2024 12:48
@mandesero mandesero added full-ci Enables full ci tests and removed full-ci Enables full ci tests labels Nov 28, 2024
@mandesero mandesero force-pushed the mandesero/gh-968-tt-downgrade branch from 8a3a4b7 to c6032e4 Compare November 28, 2024 16:56
@mandesero mandesero added full-ci Enables full ci tests and removed full-ci Enables full ci tests labels Nov 28, 2024
@oleg-jukovec
Copy link
Contributor

Please, rebase on the master branch to make the full-ci tests green.

Closes tarantool#968

@TarantoolBot document
Title: `tt replicaset downgrade` downgrades database schema.

The `tt replicaset downgrade` command allows for a automate downgrade of each
replicaset in a Tarantool cluster. The process is performed sequentially on
the master instance and its replicas to ensure data consistency. Below are
the steps involved:

For Each Replicaset:
  - **On the Master Instance**:
    1. Run the following commands in sequence to downgrade the schema and take
       a snapshot:
       ```lua
       box.schema.downgrade(<..version..>)
       box.snapshot()
       ```

  - **On Each Replica**:
    1. Wait for the replica to apply all transactions produced by the
       `box.schema.downgrade` command executed on the master. This is done
       by monitoring the vector clocks (vclock) to ensure synchronization.
    2. Once the repica has caught up, run the following command to take
       a snapshot:
       ```lua
       box.snapshot()
       ```

> **Error Handling**: If any errors occur during the downgrade process, the
operation will halt, and an error report will be generated.

---

- Specify the schema version for downgrade

The `tt replicaset downgrade` command requires specifying the target version for
the schema downgrade. This version should be provided using the `--version`
(or `-v`) option. The version must follow the `x.x.x` format, where `x` represents
a numerical value.

To view the list of available downgrade versions, execute
the following command in Tarantool:

```lua
box.schema.downgrade_versions()
```

**Example:**
```bash
$ tt replicaset downgrade [<APP_NAME> | <URI>] --version 3.0.0
```

- Timeout for Synchronization

Replicas will wait for synchronization for a maximum of `Timeout` seconds.
The default timeout is set to 5 seconds, but this can be adjusted manually
using the `--timeout` option.

**Example:**
```bash
$ tt replicaset downgrade [<APP_NAME> | <URI>] -v 3.0.0 --timeout 10
```

- Selecting Replicasets for Downgrade

You can specify which replicaset(s) to downgrade by using the `--replicaset`
or `-r` option to target specific replicaset names.

**Example:**
```bash
$ tt replicaset downgrade [<APP_NAME> | <URI>] -v 3.0.0 replicaset <RS_NAME_1> -r <RS_NAME_2> ...
```

This provides flexibility in downgrading only the desired parts of the cluster
without affecting the entire system.
@mandesero mandesero force-pushed the mandesero/gh-968-tt-downgrade branch from c6032e4 to db34a33 Compare November 28, 2024 20:46
@mandesero mandesero added full-ci Enables full ci tests and removed full-ci Enables full ci tests labels Nov 28, 2024
@oleg-jukovec oleg-jukovec requested review from patapenka-alexey and removed request for DerekBum November 29, 2024 07:18
Copy link
Contributor

@patapenka-alexey patapenka-alexey left a comment

Choose a reason for hiding this comment

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

Thank you for the patch. LGTM.

@oleg-jukovec oleg-jukovec merged commit e3a7424 into tarantool:master Nov 29, 2024
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
full-ci Enables full ci tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade/downgrade a remote cluster
3 participants