Skip to content

Commit 6afc154

Browse files
committed
Apply suggestions from review
* Some text is repeated. This is because Sphinx cannot correctly enumerate lists when list items come from different `include` files. * Clarify the "replica" term in the instructions * Clarify how to change the master in a replica set * Add cross-links to guide the user * Bring indents in accordance with the style guide * Clarify how to run code to fix xlogs when upgrading from 1.6 to 1.10
1 parent 0c60e43 commit 6afc154

File tree

5 files changed

+107
-101
lines changed

5 files changed

+107
-101
lines changed

doc/book/admin/_includes/1.6-to-2.x-condition.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ under 1.10 or 2.x for a while. A few configuration parameters are also renamed.
55

66
To perform a **live** upgrade from Tarantool 1.6 to a more recent version,
77
like :doc:`2.8.4 </release/2.8.4>`, :doc:`2.10.1 </release/2.10.1>` and such,
8-
it is necessary to take an intermediate step by upgrading 1.6 -> 1.10 -> 2.x.
9-
This is the only way to perform the upgrade without downtime.
8+
it is necessary to take an intermediate step by upgrading 1.6 -> **1.10** -> 2.x.
9+
This is the only way to perform the upgrade **without downtime**.
1010

1111
However, a direct upgrade of a replica set from 1.6 to 2.x is also possible, but only
1212
**with downtime**.
Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,46 @@
1-
1. Pick any replica in the replica set.
1+
1. Pick any read-only instance in the replica set.
22

3-
2. Upgrade this replica to the new Tarantool version. See details in
4-
:ref:`Upgrading a Tarantool instance <admin-upgrades_instance>`.
3+
2. Upgrade this replica to the new Tarantool version. See details in
4+
:ref:`Upgrading Tarantool on a standalone instance <admin-upgrades_instance>`.
5+
This requires stopping the instance for a while,
6+
which won't interrupt the replica set operation.
7+
When the upgraded replica is up again, it will synchronize with the other instances in the replica set
8+
so that the data are consistent across all the instances.
59

6-
3. Make sure the replica connected to the rest of the replica set just fine:
10+
3. Make sure the upgraded replica is running and connected to the rest of the replica set just fine.
11+
To do this, run ``box.info.replication`` in the instance's console
12+
and check the output table for values like ``upstream``, ``downstream``, and ``lag``.
713

8-
.. code-block:: tarantoolsession
14+
For each instance ``id``, there are ``upstream`` and ``downstream`` values.
15+
Both of them should have the value ``follow``, except on the instance where you run this code.
16+
This means that the replicas are connected and there are no errors in the data flow.
917

10-
box.info.replication[id].upstream
11-
box.info.replication[id].downstream
12-
13-
The ``status`` field in both outputs should have the value ``follow``.
18+
The value of the ``lag`` field can be less or equal than ``box.cfg.replication_timeout``,
19+
but it can also be moderately larger.
20+
For example, if ``box.cfg.replication_timeout`` is 1 second and the write load on the master is high,
21+
it's generally OK to have a lag of about 10 seconds on the master.
22+
It is up to the user to decide what lag values are fine.
1423

15-
4. :ref:`Upgrade <admin-upgrades_instance>` all the replicas by repeating steps 1--3
16-
until only the master keeps running the old Tarantool version.
24+
4. :ref:`Upgrade <admin-upgrades_instance>` all the read-only instances by repeating steps 1--3
25+
until only the master keeps running the old Tarantool version.
1726

18-
5. Make one of the updated replicas the new master.
19-
Check that it continues following and being followed by all other replicas.
27+
5. Make one of the updated replicas the new master:
28+
29+
- If the replica set is using asynchronous replication without
30+
:ref:`RAFT-based leader elections <repl_leader_elect>`,
31+
first run ``box.cfg{ read_only = true}`` on the old master
32+
and then run ``box.cfg{ read_only = false }`` on the replica that will be the new master.
2033

21-
6. :ref:`Upgrade <admin-upgrades_instance>` the former master.
34+
- If the replica set is using :ref:`synchronous replication <repl_sync>` or
35+
:ref:`RAFT-based leader elections <repl_leader_elect>`,
36+
run ``box.ctl.promote()`` on the new master and then run
37+
``box.cfg{ election_mode = 'voter' }`` on the old master.
38+
This will automatically change the ``read_only`` statuses on the instances.
39+
40+
- For a Cartridge replica set, it is possible to select the new master in the web UI.
41+
42+
There is no need to restart the new master.
43+
44+
Check that the new master continues following and being followed by all other replicas, similarly to step 3.
45+
46+
6. :ref:`Upgrade <admin-upgrades_instance>` the former master, which is now a read-only instance.

doc/book/admin/upgrades.rst

Lines changed: 50 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
.. _admin-upgrades:
1+
.. _admin-upgrades:
22

33
Upgrades
44
========
55

66
For information about backwards compatibility,
77
see the :ref:`compatibility guarantees <compatibility_guarantees>` description.
88

9-
.. _admin-upgrades_instance:
9+
.. _admin-upgrades_instance:
1010

1111
Upgrading Tarantool on a standalone instance
1212
--------------------------------------------
@@ -16,18 +16,25 @@ Notice that this will **always imply a downtime**.
1616
To upgrade **without downtime**, you need several Tarantool servers running in a
1717
replication cluster (see :ref:`below <admin-upgrades_replication_cluster>`).
1818

19-
1. Stop the Tarantool server.
19+
#. Stop the Tarantool server.
2020

21-
2. Make a copy of all data (see an appropriate hot backup procedure in
22-
:ref:`Backups <admin-backups>`) and the package from which the current (old)
23-
version was installed (for rollback purposes).
21+
#. Make a copy of all data (see an appropriate hot backup procedure in
22+
:ref:`Backups <admin-backups>`) and the package from which the current (old)
23+
version was installed (for rollback purposes).
2424

25-
3. Update the Tarantool server. See installation instructions at Tarantool
26-
`download page <http://tarantool.org/download.html>`_.
25+
#. Update the Tarantool server. See installation instructions at Tarantool
26+
`download page <http://tarantool.org/download.html>`_.
2727

28-
After that, make sure to :ref:`finish the upgrade properly <admin-upgrades_db>`.
28+
#. Run :ref:`box.schema.upgrade() <box_schema-upgrade>` on the new master.
29+
This will update the Tarantool system spaces to match the currently installed version of Tarantool.
30+
There is no need to run ``box.schema.upgrade()`` on every node:
31+
changes are propagated to other nodes via the regular replication mechanism.
2932

30-
.. _admin-upgrades_replication_cluster:
33+
#. Update your application files, if needed.
34+
35+
#. Launch the updated Tarantool server using ``tarantoolctl``, ``tt``, or ``systemctl``.
36+
37+
.. _admin-upgrades_replication_cluster:
3138

3239
Upgrading Tarantool in a replica set with no downtime
3340
-----------------------------------------------------
@@ -47,82 +54,50 @@ instructions for individual versions :ref:`in the list below <admin-upgrades_ver
4754
Preparations
4855
~~~~~~~~~~~~
4956

50-
#. Check the replica set health by running the following code on every instance:
57+
#. Check the replica set health by running the following code on every instance:
5158

52-
.. code-block:: tarantoolsession
59+
.. code-block:: tarantoolsession
5360
54-
box.info.ro -- "false" at least on one instance
55-
box.info.status -- should be "running"
61+
box.info.ro -- "false" at least on one instance
62+
box.info.status -- should be "running"
5663
57-
If all instances have ``box.info.ro = true``, this means there are no writable nodes.
58-
If you're running Tarantool :doc:`v. 2.10.0 </release/2.10.0>` or later,
59-
you can find out the reason by running ``box.info.ro_reason``.
60-
If it has the value ``orphan``, the instance doesn't see the rest of the replica set.
61-
Similarly, if ``box.info.status`` has the value ``orphan``, the instance doesn't see the rest of the replica set.
62-
First resolve the replication issues and only then continue.
63-
64-
If you're running Cartridge, you can also check node health in the UI.
65-
66-
#. Make sure each replica connected to the rest of the replica set.
67-
Run ``box.info.replication`` and check the output table.
68-
For each instance ``id``, there are ``upstream`` and ``downstream`` values.
69-
Both of them should have the value ``follow``, except on the instance where you run this code.
70-
This means that the replicas are connected and there are no errors in the data flow.
71-
72-
The value of the ``lag`` field can be less or equal than ``box.cfg.replication_timeout``,
73-
but it can also be moderately larger.
74-
For example, if ``box.cfg.replication_timeout`` is 1 second and the write load on the master is high,
75-
it's generally OK to have a lag of about 10 seconds on the master.
76-
It is up to the user to decide what lag values are fine.
77-
64+
If all instances have ``box.info.ro = true``, this means there are no writable nodes.
65+
If you're running Tarantool :doc:`v. 2.10.0 </release/2.10.0>` or later,
66+
you can find out the reason by running ``box.info.ro_reason``.
67+
If it has the value ``orphan``, the instance doesn't see the rest of the replica set.
68+
Similarly, if ``box.info.status`` has the value ``orphan``, the instance doesn't see the rest of the replica set.
69+
First resolve the replication issues and only then continue.
70+
71+
If you're running Cartridge, you can also check node health in the UI.
72+
73+
#. Make sure each replica is connected to the rest of the replica set.
74+
To do this, run ``box.info.replication`` in the instance's console
75+
and check the output table for values like ``upstream``, ``downstream``, and ``lag``.
76+
77+
For each instance ``id``, there are ``upstream`` and ``downstream`` values.
78+
Both of them should have the value ``follow``, except on the instance where you run this code.
79+
This means that the replicas are connected and there are no errors in the data flow.
80+
81+
The value of the ``lag`` field can be less or equal than ``box.cfg.replication_timeout``,
82+
but it can also be moderately larger.
83+
For example, if ``box.cfg.replication_timeout`` is 1 second and the write load on the master is high,
84+
it's generally OK to have a lag of about 10 seconds on the master.
85+
It is up to the user to decide what lag values are fine.
86+
7887
If the replica set is healthy, proceed to the upgrade.
7988

8089
Upgrade procedure
8190
~~~~~~~~~~~~~~~~~
8291

8392
.. include:: ./_includes/upgrade_procedure.rst
8493

85-
After upgrading the replica set, make sure to run ``box.schema.upgrade()`` on the new master
86-
as described below in the section ":ref:`Finishing the upgrade <admin-upgrades_db>`".
87-
There is no need to run ``box.schema.upgrade()`` on every node:
88-
changes are propagated to other nodes via the regular replication mechanism.
89-
90-
Finally, run ``box.snapshot()`` on every node in the replica set
91-
to make sure that the replicas immediately see the upgraded database state in case of restart.
92-
93-
.. _admin-upgrades_db:
94-
95-
Finalizing the upgrade
96-
----------------------
97-
98-
1. If you created a database with an older Tarantool version and have now installed
99-
a newer version, make the request ``box.schema.upgrade()``. This updates
100-
Tarantool system spaces to match the currently installed version of Tarantool.
101-
102-
For example, here is what happens when you run ``box.schema.upgrade()`` with a
103-
database created with Tarantool version 1.6.4 to version 1.7.2 (only a small
104-
part of the output is shown):
105-
106-
.. code-block:: tarantoolsession
107-
108-
tarantool> box.schema.upgrade()
109-
alter index primary on _space set options to {"unique":true}, parts to [[0,"unsigned"]]
110-
alter space _schema set options to {}
111-
create view _vindex...
112-
grant read access to 'public' role for _vindex view
113-
set schema version to 1.7.0
114-
---
115-
...
116-
117-
You can also put the request ``box.schema.upgrade()``
118-
inside a :doc:`box.once() </reference/reference_lua/box_once>` function in your Tarantool
119-
:ref:`initialization file <index-init_label>`.
120-
On startup, this will create new system spaces, update data type names (for example,
121-
``num`` -> ``unsigned``, ``str`` -> ``string``) and options in Tarantool system spaces.
122-
123-
2. Update your application files, if needed.
94+
7. Run :ref:`box.schema.upgrade() <box_schema-upgrade>` on the new master.
95+
This will update the Tarantool system spaces to match the currently installed version of Tarantool.
96+
There is no need to run ``box.schema.upgrade()`` on every node:
97+
changes are propagated to other nodes via the regular replication mechanism.
12498

125-
3. Launch the updated Tarantool server using ``tarantoolctl``, ``tt``, or ``systemctl``.
99+
8. Run ``box.snapshot()`` on every node in the replica set
100+
to make sure that the replicas immediately see the upgraded database state in case of restart.
126101

127102

128103
.. _admin-upgrades_version_specifics:

doc/book/admin/upgrades/1.6-1.10.rst

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,27 @@ when upgrading a replica set from Tarantool 1.6 to 1.10.
88

99
.. include:: ../_includes/1.6-to-2.x-condition.rst
1010

11-
Let's first reiterate the upgrade procedure for any Tarantool version:
11+
The procedure of live upgrade from 1.6 to 1.10 is similar to the general upgrade procedure,
12+
which is as follows:
1213

1314
.. include:: ../_includes/upgrade_procedure.rst
1415

15-
7. Run ``box.schema.upgrade()`` on the new master
16-
as described in the section ":ref:`Finishing the upgrade <admin-upgrades_db>`".
16+
7. Run :ref:`box.schema.upgrade() <box_schema-upgrade>` on the new master.
17+
This will update the Tarantool system spaces to match the currently installed version of Tarantool.
1718
There is no need to run ``box.schema.upgrade()`` on every node:
1819
changes are propagated to other nodes via the regular replication mechanism.
1920

21+
.. _admin-upgrades-1.6-1.10-step_8:
22+
2023
8. Run ``box.snapshot()`` on every node in the replica set
2124
to make sure that the replicas immediately see the upgraded database state in case of restart.
2225

2326
What's different when upgrading from Tarantool 1.6:
2427

2528
**Step 2:** Tarantool 1.10+ fails to recover from 1.6 xlogs, unless ``box.cfg{force_recovery = true}`` is set.
2629
There is some small difference between 1.6 and 1.10 xlogs, which makes 1.6 xlogs appear erroneous to 1.10+ instances.
27-
In order to work around this, start the instance in ``force_recovery`` mode.
30+
In order to work around this, start the instance in ``force_recovery`` mode. To do so, add the line
31+
``force_recovery = true`` to the file where the instance is initialized -- for example, to ``init.lua``.
2832

2933
**Step 3:** New Tarantool nodes follow 1.6 nodes just fine,
3034
but some 1.6 nodes might disconnect from new nodes with an ER_LOADING error.
@@ -38,10 +42,11 @@ This is not critical, the error goes away when replication on 1.6 is restarted:
3842
3943
**Step 7:** There was a breaking change between 1.6 and 1.10 --
4044
in 1.6, the field type ``num`` was an alias to ``number``, and in 1.10, ``num`` is converted to ``unsigned``.
41-
This means that after ``box.schema.upgrade()`` is performed on master,
45+
This means that after ``box.schema.upgrade()`` is performed on the master,
4246
the user might have some spaces with ``unsigned`` fields containing non-unsigned values:
4347
``double``, ``int``, and so on.
44-
This will make the snapshot inconsistent, unless an extra action is performed after ``box.schema.upgrade()``:
48+
This will make the snapshot inconsistent, unless an extra action is performed after ``box.schema.upgrade()``.
49+
Run this code in the Tarantool console on the new master:
4550

4651
.. code-block:: lua
4752
@@ -51,9 +56,10 @@ This will make the snapshot inconsistent, unless an extra action is performed af
5156
a[problematic_field_no].type = 'number'
5257
box.space.problematic_space:format(a)
5358
54-
Once this is performed on the master, it's safe to proceed to step 8, making snapshot on every node.
59+
Once this is performed on the master, it's safe to proceed to
60+
:ref:`step 8 <admin-upgrades-1.6-1.10-step_8>`, making a snapshot on every node.
5561

5662
**Step 8:** The user might be concerned with snapshot size in 1.10 --
5763
it's drastically smaller than the one created by 1.6 (for example, ~300 Mb vs. 6 Gb in some corner cases).
58-
There's nothing to worry about.
64+
There is nothing to worry about.
5965
Tarantool 1.6 didn't compress snapshots, while Tarantool 1.10 and above does that.

doc/book/admin/upgrades/1.6-2.0-downtime.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _admin-upgrades-1.6-2.x_downtime:
22

3-
Upgrade from 1.6 directly to 2.x
4-
================================
3+
Upgrade from 1.6 directly to 2.x with downtime
4+
==============================================
55

66
.. include:: ../_includes/1.6-to-2.x-condition.rst
77

0 commit comments

Comments
 (0)