Skip to content

Commit b16f28d

Browse files
committed
Document box.schema.downgrade (#3434)
1 parent a39115e commit b16f28d

File tree

6 files changed

+98
-1
lines changed

6 files changed

+98
-1
lines changed

doc/book/admin/upgrades.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
Upgrades
44
========
55

6+
This topic outlines the general upgrade process for Tarantool.
7+
If required, you can also downgrade to one of the previous versions using a similar procedure.
8+
69
For information about backwards compatibility,
710
see the :ref:`compatibility guarantees <compatibility_guarantees>` description.
811

@@ -30,6 +33,10 @@ replication cluster (see :ref:`below <admin-upgrades_replication_cluster>`).
3033
There is no need to run ``box.schema.upgrade()`` on every node:
3134
changes are propagated to other nodes via the regular replication mechanism.
3235

36+
.. NOTE::
37+
38+
To undo schema upgrade in a case of failed upgrade, you can use :ref:`box.schema.downgrade() <box_schema-downgrade>`.
39+
3340
#. Update your application files, if needed.
3441

3542
#. Launch the updated Tarantool server using ``tarantoolctl``, ``tt``, or ``systemctl``.
@@ -96,6 +103,10 @@ Upgrade procedure
96103
There is no need to run ``box.schema.upgrade()`` on every node:
97104
changes are propagated to other nodes via the regular replication mechanism.
98105

106+
.. NOTE::
107+
108+
To undo schema upgrade in a case of failed upgrade, you can use :ref:`box.schema.downgrade() <box_schema-downgrade>`.
109+
99110
8. Run ``box.snapshot()`` on every node in the replica set
100111
to make sure that the replicas immediately see the upgraded database state in case of restart.
101112

doc/reference/reference_lua/box_schema.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Below is a list of all ``box.schema`` functions.
1717
.. rst-class:: left-align-column-2
1818

1919
.. list-table::
20-
:widths: 25 75
20+
:widths: 35 65
2121
:header-rows: 1
2222

2323
* - Name
@@ -29,6 +29,15 @@ Below is a list of all ``box.schema`` functions.
2929
* - :doc:`./box_schema/upgrade`
3030
- Upgrade a database
3131

32+
* - :doc:`./box_schema/downgrade`
33+
- Downgrade a database
34+
35+
* - :doc:`./box_schema/downgrade_issues`
36+
- List downgrade issues for the specified Tarantool version
37+
38+
* - :doc:`./box_schema/downgrade_versions`
39+
- List Tarantool versions available for downgrade
40+
3241
* - :doc:`./box_schema/user_create`
3342
- Create a user
3443

@@ -88,6 +97,9 @@ Below is a list of all ``box.schema`` functions.
8897

8998
box_schema/space_create
9099
box_schema/upgrade
100+
box_schema/downgrade
101+
box_schema/downgrade_versions
102+
box_schema/downgrade_issues
91103
box_schema/user_create
92104
box_schema/user_drop
93105
box_schema/user_exists
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.. _box_schema-downgrade:
2+
3+
box.schema.downgrade()
4+
======================
5+
6+
.. module:: box.schema
7+
8+
.. function:: box.schema.downgrade(version)
9+
10+
Allows you to downgrade a database to the specified Tarantool version.
11+
This might be useful if you need to run a database on older Tarantool versions.
12+
13+
To prepare a database for using it on an older Tarantool instance,
14+
call ``box.schema.downgrade`` and pass the desired Tarantool version:
15+
16+
.. code-block:: tarantoolsession
17+
18+
tarantool> box.schema.downgrade('2.8.4')
19+
20+
.. NOTE::
21+
22+
The Tarantool's downgrade procedure is similar to the upgrade process that is described in the :ref:`Upgrades <admin-upgrades>` topic.
23+
You need to run ``box.schema.downgrade()`` only on master and execute `box.shapshot()` on every instance in a replica set before restart to an older version.
24+
25+
To see Tarantool versions available for downgrade, call :ref:`box.schema.downgrade_versions() <box_schema-downgrade_versions>`. The oldest release available for downgrade is ``2.8.2``.
26+
27+
Note that the downgrade process might fail if the database enables specific features not supported
28+
in the target Tarantool version.
29+
You can see all such issues using the :ref:`box.schema.downgrade_issues() <box_schema-downgrade_issues>` method,
30+
which accepts the target version.
31+
For example, ``downgrade`` to the ``2.8.4`` version fails if you use `tuple compression <https://www.tarantool.io/en/enterprise_doc/tuple_compression/>`__ or field :ref:`constraints <index-constraint_functions>` in your database:
32+
33+
.. code-block:: tarantoolsession
34+
35+
tarantool> box.schema.downgrade_issues('2.8.4')
36+
---
37+
- - Tuple compression is found in space 'bands', field 'band_name'. It is supported
38+
starting from version 2.10.0.
39+
- Field constraint is found in space 'bands', field 'year'. It is supported starting
40+
from version 2.10.0.
41+
...
42+
43+
See also: :ref:`box.schema.upgrade() <box_schema-upgrade>`
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.. _box_schema-downgrade_issues:
2+
3+
box.schema.downgrade_issues()
4+
=============================
5+
6+
.. module:: box.schema
7+
8+
.. function:: box.schema.downgrade_issues(version)
9+
10+
Return a list of downgrade issues for the specified Tarantool version.
11+
To learn how to downgrade a database to the specified Tarantool version, see :ref:`box.schema.downgrade() <box_schema-downgrade>`.
12+
13+
:return: a list of downgrade issues
14+
:rtype: table
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.. _box_schema-downgrade_versions:
2+
3+
box.schema.downgrade_versions()
4+
===============================
5+
6+
.. module:: box.schema
7+
8+
.. function:: box.schema.downgrade_versions()
9+
10+
Return a list of Tarantool versions available for downgrade.
11+
To learn how to downgrade a database to the specified Tarantool version, see :ref:`box.schema.downgrade() <box_schema-downgrade>`.
12+
13+
:return: a list of Tarantool versions
14+
:rtype: table

doc/reference/reference_lua/box_schema/upgrade.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ box.schema.upgrade()
1010
If you created a database with an older Tarantool version and have now installed
1111
a newer version, make the request ``box.schema.upgrade()``. This updates
1212
Tarantool system spaces to match the currently installed version of Tarantool.
13+
You can learn about the general upgrade process from the :ref:`Upgrades <admin-upgrades>` topic.
1314

1415
For example, here is what happens when you run ``box.schema.upgrade()`` with a
1516
database created with Tarantool version 1.6.4 to version 1.7.2 (only a small
@@ -31,3 +32,5 @@ box.schema.upgrade()
3132
:ref:`initialization file <index-init_label>`.
3233
On startup, this will create new system spaces, update data type names (for example,
3334
``num`` -> ``unsigned``, ``str`` -> ``string``) and options in Tarantool system spaces.
35+
36+
See also: :ref:`box.schema.downgrade() <box_schema-downgrade>`

0 commit comments

Comments
 (0)