Skip to content

Commit 6f9be5e

Browse files
committed
Review fixes
1 parent 8aa777c commit 6f9be5e

File tree

4 files changed

+118
-99
lines changed

4 files changed

+118
-99
lines changed

doc/platform/ddl_dml/migrations/basic_migrations_tt.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ 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 distribution
29+
- use the `CRUD <https://github.com/tarantool/crud>`__ module or its Enterprise
30+
version for data distribution
3031

3132
.. _basic_migrations_tt_cluster_etcd:
3233

@@ -268,7 +269,9 @@ Check the migrations status with ``tt migration status``:
268269
To make sure that the space and indexes are created in the cluster, connect to the router
269270
instance and retrieve the space information:
270271

271-
.. code-block:: $ tt connect myapp:router-001
272+
.. code-block:: console
273+
274+
$ tt connect myapp:router-001-a
272275
273276
.. code-block:: tarantoolsession
274277

doc/platform/ddl_dml/migrations/troubleshoot_migrations_tt.rst

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,14 @@ the ``--force-reapply`` option:
5959
If execution of the incorrect migration version has failed, you may also need to add
6060
the ``--ignore-preceding-status`` option:
6161

62+
When you reapply a migration, ``tt`` checks the statuses of preceding migrations
63+
to ensure consistency. To skip this check, add the ``--ignore-preceding-status`` option:
64+
6265
.. code-block:: console
6366
64-
$ tt migrations apply http://app_user:config_pass@localhost:2379/myapp \
67+
$ tt migrations apply "http://app_user:config_pass@localhost:2379/myapp" \
6568
--tarantool-username=client --tarantool-password=secret \
69+
--migration=00003_alter_space.lua
6670
--force-reapply --ignore-preceding-status
6771
6872
.. _centralized_migrations_tt_troubleshoot_stop:
@@ -77,11 +81,16 @@ To interrupt migration execution on the cluster, use ``tt migrations stop``:
7781
$ tt migrations stop "http://app_user:config_pass@localhost:2379/myapp" \
7882
--tarantool-username=client --tarantool-password=secret
7983
80-
To avoid such situations in the future, restrict the maximum migration execution time
81-
using the ``--execution-timeout`` option of ``tt migrations apply``:
84+
You can adjust the maximum migration execution time using the ``--execution-timeout``
85+
option of ``tt migrations apply``:
8286

8387
.. code-block:: console
8488
8589
$ tt migrations apply "http://app_user:config_pass@localhost:2379/myapp" \
8690
--tarantool-username=client --tarantool-password=secret \
87-
--execution-timeout=60
91+
--execution-timeout=60
92+
93+
.. note::
94+
95+
If a migration timeout is reached, you may need to call ``tt migrations stop``
96+
to cancel requests that were sent when applying migrations.

doc/platform/ddl_dml/migrations/upgrade_migrations_tt.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Writing a complex migration
2525
Complex migrations require data migration along with schema migration. Connect to
2626
the router instance and insert some tuples into the space before proceeding to the next steps.
2727

28-
.. code-block:: $ tt connect myapp:router-001
28+
.. code-block:: $ tt connect myapp:router-001-a
2929

3030
.. code-block:: tarantoolsession
3131
@@ -125,13 +125,15 @@ Apply the published migrations:
125125
126126
Connect to the router instance and check that the space and its tuples have the new format:
127127

128-
.. code-block:: $ tt connect myapp:router-001
128+
.. code-block:: console
129+
130+
$ tt connect myapp:router-001-a
129131
130132
.. code-block:: tarantoolsession
131133
132134
myapp:router-001-a> require('crud').get('writers', 2)
133135
---
134-
- rows: []
136+
- rows: [2, 401, 'Douglas', 'Adams', 49]
135137
metadata: [{'name': 'id', 'type': 'number'}, {'name': 'bucket_id', 'type': 'number'},
136138
{'name': 'first_name', 'type': 'string'}, {'name': 'last_name', 'type': 'string'},
137139
{'name': 'age', 'type': 'number'}]

doc/tooling/tt_cli/migrations.rst

Lines changed: 95 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -22,56 +22,14 @@ on using the centralized migrations mechanism.
2222

2323
``COMMAND`` is one of the following:
2424

25-
* :ref:`apply <tt-migrations-apply>`
25+
2626
* :ref:`publish <tt-migrations-publish>`
27-
* :ref:`remove <tt-migrations-remove>`
27+
* :ref:`apply <tt-migrations-apply>`
2828
* :ref:`status <tt-migrations-status>`
2929
* :ref:`stop <tt-migrations-stop>`
30+
* :ref:`remove <tt-migrations-remove>`
3031

3132

32-
.. _tt-migrations-apply:
33-
34-
apply
35-
-----
36-
37-
.. code-block:: console
38-
39-
$ tt migrations apply ETCD_URI [OPTION ...]
40-
41-
``tt migrations apply`` applies :ref:`published <tt-migrations-publish>` migrations
42-
to the cluster. It executes all migrations from the cluster's centralized
43-
configuration storage on all its read-write instances (replica set leaders).
44-
45-
.. code-block:: console
46-
47-
$ tt migrations apply "https://user:pass@localhost:2379/myapp" \
48-
--tarantool-username=admin --tarantool-password=pass
49-
50-
To apply a single published migration, pass its name in the ``--migration`` option:
51-
52-
.. code-block:: console
53-
54-
$ tt migrations apply "https://user:pass@localhost:2379/myapp" \
55-
--tarantool-username=admin --tarantool-password=pass \
56-
--migration=000001_create_space.lua
57-
58-
To apply migrations on a single replica set, specify the ``replicaset`` option:
59-
60-
.. code-block:: console
61-
62-
$ tt migrations apply "https://user:pass@localhost:2379/myapp" \
63-
--tarantool-username=admin --tarantool-password=pass \
64-
--replicaset=storage-001
65-
66-
The command also provides options for migration troubleshooting: ``--ignore-order-violation``,
67-
``--force-reapply``, and ``--ignore-preceding-status``. Learn to use them in
68-
:ref:`centralized_migrations_tt_troubleshoot`.
69-
70-
.. warning::
71-
72-
The use of migration troubleshooting options may lead to migration inconsistency
73-
in the cluster. Use them only for local development and testing purposes.
74-
7533
.. _tt-migrations-publish:
7634

7735
publish
@@ -125,66 +83,52 @@ When publishing migrations, ``tt`` performs checks for:
12583
.. warning::
12684

12785
Using the options that ignore checks when publishing migration may cause
128-
migration inconsistency in the etcd storage.
86+
migration inconsistency in the cluster.
12987

130-
.. _tt-migrations-remove:
13188

132-
remove
133-
------
89+
.. _tt-migrations-apply:
13490

135-
.. code-block:: console
91+
apply
92+
-----
13693

137-
$ tt migrations remove ETCD_URI [OPTION ...]
94+
.. code-block:: console
13895
139-
``tt migrations remove`` removes published migrations from the centralized storage.
140-
With additional options, it can also remove the information about the migration execution
141-
on the cluster instances.
96+
$ tt migrations apply ETCD_URI [OPTION ...]
14297
143-
To remove all migrations from a specified centralized storage:
98+
``tt migrations apply`` applies :ref:`published <tt-migrations-publish>` migrations
99+
to the cluster. It executes all migrations from the cluster's centralized
100+
configuration storage on all its read-write instances (replica set leaders).
144101

145102
.. code-block:: console
146103
147-
$ tt migrations remove "https://user:pass@localhost:2379/myapp" \
148-
--tarantool-username=admin --tarantool-password=pass
104+
$ tt migrations apply "https://user:pass@localhost:2379/myapp" \
105+
--tarantool-username=admin --tarantool-password=pass
149106
150-
To remove a specific migration, pass its name in the ``--migration`` option:
107+
To apply a single published migration, pass its name in the ``--migration`` option:
151108

152109
.. code-block:: console
153110
154-
$ tt migrations remove "https://user:pass@localhost:2379/myapp" \
155-
--tarantool-username=admin --tarantool-password=pass \
156-
--migration=000001_create_writers_space.lua
111+
$ tt migrations apply "https://user:pass@localhost:2379/myapp" \
112+
--tarantool-username=admin --tarantool-password=pass \
113+
--migration=000001_create_space.lua
157114
158-
Before removing migrations, the command checks their :ref:`status <tt-migrations-status>`
159-
on the cluster. To ignore the status and remove migrations anyway, add the
160-
``--force-remove-on=config-storage`` option:
115+
To apply migrations on a single replica set, specify the ``replicaset`` option:
161116

162117
.. code-block:: console
163118
164-
$ tt migrations remove "https://user:pass@localhost:2379/myapp" \
165-
--force-remove-on=config-storage
166-
167-
.. note::
168-
169-
In this case, cluster credentials are not required.
170-
171-
To remove migration execution information from the cluster (clear the migration status),
172-
use the ``--force-remove-on=cluster`` option:
173-
174-
.. code-block:: console
119+
$ tt migrations apply "https://user:pass@localhost:2379/myapp" \
120+
--tarantool-username=admin --tarantool-password=pass \
121+
--replicaset=storage-001
175122
176-
$ tt migrations remove "https://user:pass@localhost:2379/myapp" \
177-
--tarantool-username=admin --tarantool-password=pass \
178-
--force-remove-on=cluster
123+
The command also provides options for migration troubleshooting: ``--ignore-order-violation``,
124+
``--force-reapply``, and ``--ignore-preceding-status``. Learn to use them in
125+
:ref:`centralized_migrations_tt_troubleshoot`.
179126

180-
To clear all migration information from the centralized storage and cluster,
181-
use the ``--force-remove-on=all`` option:
127+
.. warning::
182128

183-
.. code-block:: console
129+
The use of migration troubleshooting options may lead to migration inconsistency
130+
in the cluster. Use them only for local development and testing purposes.
184131

185-
$ tt migrations remove "https://user:pass@localhost:2379/myapp" \
186-
--tarantool-username=admin --tarantool-password=pass \
187-
--force-remove-on=all
188132

189133
.. _tt-migrations-status:
190134

@@ -201,6 +145,7 @@ storage and the result of their execution on the cluster instances.
201145
Possible migration statuses are:
202146

203147
- ``APPLY_STARTED`` -- the migration execution has started but not completed yet
148+
or has been interrupted with :ref:`tt migrations stop <tt-migrations-stop>``
204149
- ``APPLIED`` -- the migration is successfully applied on the instance
205150
- ``FAILED`` -- there were errors during the migration execution on the instance
206151

@@ -254,16 +199,76 @@ stop
254199

255200
Calling ``tt migration stop`` may cause migration inconsistency in the cluster.
256201

257-
To stop execution of migrations currently running in the cluster:
202+
To stop the execution of a migration currently running in the cluster:
258203

259204
.. code-block:: console
260205
261206
$ tt migrations stop "https://user:pass@localhost:2379/myapp" \
262207
--tarantool-username=admin --tarantool-password=pass
263208
264-
Q: can any migrations in a batch complete successfully? If I apply 2 migrations and call
265-
`tt migrations stop` after the first one is finished without errors, what are migration statuses?
209+
``tt migrations stop`` interrupts a single migration. If you call it to interrupt
210+
the process that applies multiple migrations, the ones completed before the call
211+
receive the ``APPLIED`` status. The migration is interrupted by the call remains in
212+
``APPLY_STARTED``.
213+
214+
.. _tt-migrations-remove:
215+
216+
remove
217+
------
218+
219+
.. code-block:: console
220+
221+
$ tt migrations remove ETCD_URI [OPTION ...]
222+
223+
``tt migrations remove`` removes published migrations from the centralized storage.
224+
With additional options, it can also remove the information about the migration execution
225+
on the cluster instances.
226+
227+
To remove all migrations from a specified centralized storage:
228+
229+
.. code-block:: console
230+
231+
$ tt migrations remove "https://user:pass@localhost:2379/myapp" \
232+
--tarantool-username=admin --tarantool-password=pass
233+
234+
To remove a specific migration, pass its name in the ``--migration`` option:
235+
236+
.. code-block:: console
237+
238+
$ tt migrations remove "https://user:pass@localhost:2379/myapp" \
239+
--tarantool-username=admin --tarantool-password=pass \
240+
--migration=000001_create_writers_space.lua
241+
242+
Before removing migrations, the command checks their :ref:`status <tt-migrations-status>`
243+
on the cluster. To ignore the status and remove migrations anyway, add the
244+
``--force-remove-on=config-storage`` option:
245+
246+
.. code-block:: console
247+
248+
$ tt migrations remove "https://user:pass@localhost:2379/myapp" \
249+
--force-remove-on=config-storage
266250
251+
.. note::
252+
253+
In this case, cluster credentials are not required.
254+
255+
To remove migration execution information from the cluster (clear the migration status),
256+
use the ``--force-remove-on=cluster`` option:
257+
258+
.. code-block:: console
259+
260+
$ tt migrations remove "https://user:pass@localhost:2379/myapp" \
261+
--tarantool-username=admin --tarantool-password=pass \
262+
--force-remove-on=cluster
263+
264+
To clear all migration information from the centralized storage and cluster,
265+
use the ``--force-remove-on=all`` option:
266+
267+
.. code-block:: console
268+
269+
$ tt migrations remove "https://user:pass@localhost:2379/myapp" \
270+
--tarantool-username=admin --tarantool-password=pass \
271+
--force-remove-on=all
267272
268273
.. _tt-migrations-auth:
269274

@@ -273,10 +278,10 @@ Authentication
273278
Since ``tt migrations`` operates migrations via a centralizes etcd storage, it
274279
needs credentials to access this storage. There are two ways to pass etcd credentials:
275280

276-
- command options ``--config-storage-username`` and ``--config-storage-password``
281+
- command-line options ``--config-storage-username`` and ``--config-storage-password``
277282
- the etcd URI, for example, ``https://user:pass@localhost:2379/myapp``
278283

279-
Q: which way has a higher priority?
284+
Credentials specified in the URI have a higher priority.
280285

281286
For commands that connect to the cluster (that is, all except ``publish``), Tarantool
282287
credentials are also required. The are passed in the ``--tarantool-username`` and
@@ -386,7 +391,7 @@ Options
386391

387392
**Applicable to:** ``apply``, ``remove``, ``status``
388393

389-
migration to remove
394+
A migration to apply, remove, or check status.
390395

391396
.. option:: --overwrite
392397

0 commit comments

Comments
 (0)