Skip to content

Commit ab1867c

Browse files
committed
Fix
1 parent 0d20803 commit ab1867c

File tree

6 files changed

+106
-90
lines changed

6 files changed

+106
-90
lines changed

doc/platform/ddl_dml/migrations/basic_migrations_tt.rst

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Preparing a cluster
2626
The centralized migration mechanism works with Tarantool EE clusters that:
2727

2828
- use etcd as a centralized configuration storage
29-
- use the `CRUD <https://github.com/tarantool/crud>`__ module for data sharding
29+
- use the `CRUD <https://github.com/tarantool/crud>`__ module for data distribution
3030

3131
.. _basic_migrations_tt_cluster_etcd:
3232

@@ -207,7 +207,7 @@ To publish migrations to the etcd configuration storage, run ``tt migrations pub
207207

208208
.. code-block:: console
209209
210-
$ tt migrations publish http://app_user:config_pass@localhost:2379/myapp
210+
$ tt migrations publish "http://app_user:config_pass@localhost:2379/myapp"
211211
• 000001_create_writes_space.lua: successfully published to key "000001_create_writes_space.lua"
212212
• 000002_create_writers_index.lua: successfully published to key "000002_create_writers_index.lua"
213213
@@ -221,7 +221,7 @@ a cluster user's credentials:
221221

222222
.. code-block:: console
223223
224-
$ tt migrations apply http://app_user:config_pass@localhost:2379/myapp \
224+
$ tt migrations apply "http://app_user:config_pass@localhost:2379/myapp" \
225225
--tarantool-username=client --tarantool-password=secret
226226
227227
.. important::
@@ -249,7 +249,8 @@ Check the migrations status with ``tt migration status``:
249249

250250
.. code-block:: console
251251
252-
$ tt migrations status http://app_user:config_pass@localhost:2379/myapp --tarantool-username=client --tarantool-password=secret
252+
$ tt migrations status "http://app_user:config_pass@localhost:2379/myapp" \
253+
--tarantool-username=client --tarantool-password=secret
253254
• migrations centralized storage scenarios:
254255
• 000001_create_writes_space.lua
255256
• 000002_create_writers_index.lua
@@ -297,3 +298,10 @@ instance and retrieve the space information:
297298
format: [{'name': 'id', 'type': 'number'}, {'type': 'number', 'name': 'bucket_id',
298299
'is_nullable': true}, {'name': 'name', 'type': 'string'}, {'name': 'age', 'type': 'number'}]
299300
...
301+
302+
.. _basic_migrations_tt_next:
303+
304+
Next steps
305+
----------
306+
307+
Learn to write and perform data migration in :ref:`upgrade_migrations_tt`.

doc/platform/ddl_dml/migrations/extend_migrations_tt.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ Apply all stored migrations to the cluster to load the same data schema to the n
7373

7474
.. code-block:: console
7575
76-
$ tt migrations apply http://app_user:config_pass@localhost:2379/myapp \
76+
$ tt migrations apply "http://app_user:config_pass@localhost:2379/myapp" \
7777
--tarantool-username=client --tarantool-password=secret
78-
--replicaset storage-003
78+
--replicaset=storage-003
7979
8080
.. note::
8181

@@ -85,7 +85,7 @@ Apply all stored migrations to the cluster to load the same data schema to the n
8585

8686
.. code-block:: console
8787
88-
$ tt migrations apply http://app_user:config_pass@localhost:2379/myapp \
88+
$ tt migrations apply "http://app_user:config_pass@localhost:2379/myapp" \
8989
--tarantool-username=client --tarantool-password=secret
9090
9191
To make sure that the space exists on the new instances, connect to ``storage-003-a``

doc/platform/ddl_dml/migrations/index.rst

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,26 @@ Migrations
44
==========
55

66
**Migration** refers to any change in a data schema: adding or removing a field,
7-
creating or dropping an index, changing a field format, an so on. Space creation
8-
is also a schema migration. You can use this fact to track the evolution of your
9-
data schema since its initial state.
7+
creating or dropping an index, changing a field format, and so on. Space creation
8+
is also a migration. Using migrations, you can track the evolution of your
9+
data schema since its initial state. In Tarantool, migrations are presented as Lua
10+
code that alters the data schema using the built-in Lua API.
1011

1112
There are two types of migrations:
1213

1314
- *simple migrations* don't require additional actions on existing data
1415
- *complex migrations* include both schema and data changes
1516

16-
In Tarantool, migrations are presented as Lua code that alters the data schema
17-
using the built-in Lua API.
18-
1917
.. _migrations_simple:
2018

2119
Simple migrations
2220
-----------------
2321

24-
In Tarantool, there are two types of schema migration that do not require data migration:
22+
There are two types of schema migration that do not require data migration:
2523

26-
- Creating an index. A new index can be created at any time. To learn more about
24+
- *Creating an index*. A new index can be created at any time. To learn more about
2725
index creation, see :ref:`concepts-data_model_indexes` and the :ref:`box_space-create_index` reference.
28-
- Adding a field to the end of a space. To add a field, update the space format so
26+
- *Adding a field to the end of a space*. To add a field, update the space format so
2927
that it includes all its fields and also the new field. For example:
3028

3129
.. code-block:: lua
@@ -79,17 +77,17 @@ its availability requirements.
7977

8078
Tarantool offers the following features that make migrations easier and safer:
8179

82-
- Transaction mechanism. It is useful when writing a migration,
80+
- *Transaction mechanism*. It is useful when writing a migration,
8381
because it allows you to work with the data atomically. But before using
8482
the transaction mechanism, you should explore its limitations.
8583
For details, see the section about :ref:`transactions <atomic-atomic_execution>`.
8684

87-
- ``space:upgrade()`` function (EE only). With the help of ``space:upgrade()``,
85+
- ``space:upgrade()`` *function* (EE only). With the help of ``space:upgrade()``,
8886
you can enable compression and migrate, including already created tuples.
8987
For details, check the :ref:`Upgrading space schema <enterprise-space_upgrade>` section.
9088

91-
- Centralized migration management mechanism (EE only). Implemented
92-
in the Enterprise version of the :ref:`tt <tt-cli>` utility and :ref:`tcm`,
89+
- *Centralized migration management mechanism* (EE only). Implemented
90+
in the Enterprise version of the :ref:`tt <tt-cli>` utility and in :ref:`tcm`,
9391
this mechanism enables migration execution and tracking in the replication
9492
clusters. For details, see :ref:`migrations_centralized`.
9593

@@ -159,9 +157,6 @@ To learn how to manage migrations in Tarantool EE clusters from the command line
159157
see :ref:`centralized_migrations_tt`. To learn how to use the mechanism from the |tcm|
160158
web interface, see the :ref:`tcm_migrations` |tcm| documentation page.
161159

162-
The ``tt`` implementation of the mechanism additionally includes commands for
163-
troubleshooting migration issues. :ref:`troubleshooting_migrations_tt`.
164-
165160
.. toctree::
166161
:maxdepth: 1
167162

doc/platform/ddl_dml/migrations/troubleshoot_migrations_tt.rst

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@
33
Troubleshooting migrations
44
--------------------------
55

6+
The centralized migrations mechanism allows troubleshooting migration issues using
7+
dedicated ``tt migration`` options. When troubleshooting migrations, remember that
8+
any unfinished or failed migration can bring the data schema into to inconsistency.
9+
Additional steps may be needed to fix this.
10+
611
.. warning::
712

8-
The options used for migration troubleshooting can cause migration inconsistency in the cluster.
13+
The options used for migration troubleshooting can cause migration inconsistency
14+
in the cluster. Use them only for local development and testing purposes.
915

1016
.. _centralized_migrations_tt_troubleshoot_publish:
1117

@@ -17,23 +23,23 @@ fix the migration file and publish it again with the ``--overwrite`` option:
1723

1824
.. code-block:: console
1925
20-
$ tt migrations publish http://app_user:config_pass@localhost:2379/myapp \
26+
$ tt migrations publish "http://app_user:config_pass@localhost:2379/myapp" \
2127
000001_create_space.lua --overwrite
2228
2329
If the migration that needs a fix isn't the last in the lexicographical order,
2430
add also ``--ignore-order-violation``:
2531

2632
.. code-block:: console
2733
28-
$ tt migrations publish http://app_user:config_pass@localhost:2379/myapp \
34+
$ tt migrations publish "http://app_user:config_pass@localhost:2379/myapp" \
2935
000001_create_space.lua --overwrite --ignore-order-violation
3036
3137
If a migration was published by mistake and wasn't applied yet, you can delete it
3238
from etcd using ``tt migrations remove``:
3339

3440
.. code-block:: console
3541
36-
$ tt migrations remove http://app_user:config_pass@localhost:2379/myapp \
42+
$ tt migrations remove "http://app_user:config_pass@localhost:2379/myapp" \
3743
--migration 000003_not_needed.lua
3844
3945
.. _centralized_migrations_tt_troubleshoot_apply:
@@ -46,7 +52,7 @@ the ``--force-reapply`` option:
4652

4753
.. code-block:: console
4854
49-
$ tt migrations apply http://app_user:config_pass@localhost:2379/myapp \
55+
$ tt migrations apply "http://app_user:config_pass@localhost:2379/myapp" \
5056
--tarantool-username=client --tarantool-password=secret \
5157
--force-reapply
5258
@@ -68,14 +74,14 @@ To interrupt migration execution on the cluster, use ``tt migrations stop``:
6874

6975
.. code-block:: console
7076
71-
$ tt migrations stop http://app_user:config_pass@localhost:2379/myapp \
77+
$ tt migrations stop "http://app_user:config_pass@localhost:2379/myapp" \
7278
--tarantool-username=client --tarantool-password=secret
7379
7480
To avoid such situations in the future, restrict the maximum migration execution time
7581
using the ``--executions-timeout`` option of ``tt migrations apply``:
7682

7783
.. code-block:: console
7884
79-
$ tt migrations apply http://app_user:config_pass@localhost:2379/myapp \
85+
$ tt migrations apply "http://app_user:config_pass@localhost:2379/myapp" \
8086
--tarantool-username=client --tarantool-password=secret \
8187
--execution-timeout=60

doc/platform/ddl_dml/migrations/upgrade_migrations_tt.rst

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
.. _upgrade_migrations_tt:
22

3-
Complex migrations with space.upgrade()
4-
=======================================
3+
Data migrations with space.upgrade()
4+
====================================
55

66
**Example on GitHub:** `migrations <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/migrations>`_
77

88
In this tutorial, you learn to write migrations that include data migration using
99
the ``space.upgrade()`` function.
1010

11-
See also:
12-
13-
- :ref:`tt migrations <tt-migrations>` for the full list of command-line options.
14-
- :ref:`tcm_cluster_migrations` to learn about managing migrations from |tcm_full_name|.
15-
1611
.. _upgrade_migrations_tt:
1712

1813
Prerequisites
@@ -75,7 +70,7 @@ Start the migration function with the new format description:
7570
new format.
7671

7772
Next, create a stored function that transforms tuples to fit the new format.
78-
In this case, the functions extracts the first and the last name from the ``name`` field
73+
In this case, the function extracts the first and the last name from the ``name`` field
7974
and returns a tuple of the new format:
8075

8176
.. literalinclude:: /code_snippets/snippets/migrations/migrations/scenario/000003_alter_writers_space.lua
@@ -91,18 +86,18 @@ as its arguments. Here is the complete migration code:
9186
:language: lua
9287
:dedent:
9388

94-
Learn more about ``space.upgrade()`` execution in :ref:`enterprise-space_upgrade`.
89+
Learn more about ``space.upgrade()`` in :ref:`enterprise-space_upgrade`.
9590

9691
.. _upgrade_migrations_tt_publish:
9792

9893
Publishing the migration
9994
------------------------
10095

101-
Publish the new migration to etcd. Migrations that already exist in the storage are skipped.
96+
Publish the new migration to etcd.
10297

10398
.. code-block:: console
10499
105-
$ tt migrations publish http://app_user:config_pass@localhost:2379/myapp \
100+
$ tt migrations publish "http://app_user:config_pass@localhost:2379/myapp" \
106101
migrations/scenario/000003_alter_writers_space.lua
107102
108103
.. note::
@@ -113,7 +108,7 @@ Publish the new migration to etcd. Migrations that already exist in the storage
113108

114109
.. code-block:: console
115110
116-
$ tt migrations publish http://app_user:config_pass@localhost:2379/myapp
111+
$ tt migrations publish "http://app_user:config_pass@localhost:2379/myapp"
117112
118113
119114
.. _upgrade_migrations_tt_apply:
@@ -125,7 +120,7 @@ Apply the published migrations:
125120

126121
.. code-block:: console
127122
128-
$ tt migrations apply http://app_user:config_pass@localhost:2379/myapp \
123+
$ tt migrations apply "http://app_user:config_pass@localhost:2379/myapp" \
129124
--tarantool-username=client --tarantool-password=secret
130125
131126
Connect to the router instance and check that the space and its tuples have the new format:
@@ -142,3 +137,12 @@ Connect to the router instance and check that the space and its tuples have the
142137
{'name': 'age', 'type': 'number'}]
143138
- null
144139
...
140+
141+
142+
.. _upgrade_migrations_tt_next:
143+
144+
Next steps
145+
----------
146+
147+
Learn to use migrations for data schema definition on new instances added to the cluster
148+
in :ref:`extend_migrations_tt`.

0 commit comments

Comments
 (0)