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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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
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 marked this pull request as ready for review November 27, 2024 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade/downgrade a remote cluster
2 participants