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

Make box.schema.upgrade transactional #5215

Open
kyukhin opened this issue Jul 29, 2020 · 1 comment
Open

Make box.schema.upgrade transactional #5215

kyukhin opened this issue Jul 29, 2020 · 1 comment
Labels
blocked Not ready to be implemented feature A new functionality upgrade
Milestone

Comments

@kyukhin
Copy link
Contributor

kyukhin commented Jul 29, 2020

When transacational DDL is fully implemented, we need to refactor box.schema.upgrade() script to make it transactional. It is now possible to broke Tarantool when it is being upgraded under load.

Blocked by #3800

@kyukhin kyukhin added feature A new functionality upgrade labels Jul 29, 2020
@kyukhin kyukhin added this to the 2.6.2 milestone Jul 29, 2020
@kyukhin kyukhin added the blocked Not ready to be implemented label Jul 29, 2020
@kyukhin kyukhin modified the milestones: 2.6.2, 2.7.1 Jul 29, 2020
@Totktonada
Copy link
Member

Jira: TNT-34 (by @rtokarev).

Обновление схемы при апгрейде с 1.10.3 на 2.3.2 ломает sequence

На некоторых шардах при выполнении box.schema.upgrade() после апдейта всех реплик с 1.10.3 на 2.3.2 сломался индекс с sequence'ом, а именно sequence пропал из индекса, что начало приводить к фейлам при вставке в соответствующий спейс, т.к. sequence генерит часть ключа.

Происходило это тогда, когда прилетали апдейты до завершения выполнения box.schema.upgrade().

Из лога видно, что схема дошла только до 2.1.3, прилетел апдейт и мы упали, но sequence'а все равно не появился.

2020-07-13T17:01:10.407 <...> <...>: 2020-07-13 17:01:10.407 [15528] main/9422/console/unix/: I> create index primary on _fk_constraint
2020-07-13T17:01:10.407 <...> <...>: 2020-07-13 17:01:10.407 [15528] main/9422/console/unix/: I> create secondary index child_id on _fk_constraint
2020-07-13T17:01:10.407 <...> <...>: 2020-07-13 17:01:10.407 [15528] main/9422/console/unix/: I> Add nullable value field to space _schema
2020-07-13T17:01:10.410 <...> <...>: 2020-07-13 17:01:10.410 [15528] main/9422/console/unix/: I> set schema version to 2.1.0
2020-07-13T17:01:10.410 <...> <...>: 2020-07-13 17:01:10.411 [15528] main/9422/console/unix/: I> set schema version to 2.1.1
2020-07-13T17:01:10.421 <...> <...>: 2020-07-13 17:01:10.421 [15528] main/9422/console/unix/: I> set schema version to 2.1.2
2020-07-13T17:01:10.421 <...> <...>: 2020-07-13 17:01:10.421 [15528] main/9422/console/unix/: I> creating collation unicode_af_s1
2020-07-13T17:01:10.447 <...> <...>: 2020-07-13 17:01:10.448 [15528] main/9422/console/unix/: I> creating collation unicode_af_s2
2020-07-13T17:01:10.448 <...> <...>: 2020-07-13 17:01:10.448 [15528] main/9422/console/unix/: I> creating collation unicode_af_s3
2020-07-13T17:01:10.448 <...> <...>: 2020-07-13 17:01:10.448 [15528] main/9422/console/unix/: I> creating collation unicode_am_s1
...
2020-07-13T17:01:10.990 <...> <...>: 2020-07-13 17:01:10.991 [15528] main/9422/console/unix/: I> creating collation unicode_zh__zhuyin_s2
2020-07-13T17:01:10.990 <...> <...>: 2020-07-13 17:01:10.991 [15528] main/9422/console/unix/: I> creating collation unicode_zh__zhuyin_s3
2020-07-13T17:01:10.990 <...> <...>: 2020-07-13 17:01:10.991 [15528] main/9422/console/unix/: I> set schema version to 2.1.3
2020-07-13T17:01:10.990 <...> <...>: 2020-07-13 17:01:10.991 [15528] main/9422/console/unix/: I> add sequence field to space _space_sequence
2020-07-13T17:01:10.991 <...> <...>: 2020-07-13 17:01:10.991 [15528] main/9423/main <...>.lua:251 E> <...>: stack traceback:
2020-07-13T17:01:10.991 <...> <...>:     /usr/local/share/tarantool/<...>.lua:455: in function </usr/local/share/tarantool/<...>.lua:453>
2020-07-13T17:01:10.991 <...> <...>:     [C]: in function '<...>'
2020-07-13T17:01:10.991 <...> <...>:     /usr/local/share/tarantool/<...>.lua:1904: in function '<...>'
2020-07-13T17:01:10.991 <...> <...>:     /usr/local/share/tarantool/<...>.lua:2009: in function </usr/local/share/tarantool/<...>.lua:2008>
2020-07-13T17:01:10.991 <...> <...>:     [C]: in function '<...>'
2020-07-13T17:01:10.991 <...> <...>:     /usr/local/share/tarantool/<...>.lua:2038: in function </usr/local/share/tarantool/<...>.lua:2033>
2020-07-13T17:01:10.991 <...> <...>:     [C]: at 0x004fa0f0 (455)
2020-07-13T17:01:10.991 <...> <...>: 2020-07-13 17:01:10.991 [15528] main/9423/main <...>.lua:251 E> <...>: Tuple field 1 type does not match one required by operation: expected unsigned (457)

Потом докатили схему еще одним вызовом box.schema.upgrade()

2020-07-13T17:40:34.085 <...> <...>: 2020-07-13 17:40:34.086 [3277] main/113/console/unix/: I> add sequence field to space _space_sequence
2020-07-13T17:40:34.086 <...> <...>: 2020-07-13 17:40:34.086 [3277] main/113/console/unix/: I> create space _ck_constraint
2020-07-13T17:40:34.086 <...> <...>: 2020-07-13 17:40:34.086 [3277] main/113/console/unix/: I> create index primary on _ck_constraint
2020-07-13T17:40:34.086 <...> <...>: 2020-07-13 17:40:34.087 [3277] main/113/console/unix/: I> create view _vcollation...
2020-07-13T17:40:34.087 <...> <...>: 2020-07-13 17:40:34.087 [3277] main/113/console/unix/: I> create index primary on _vcollation
2020-07-13T17:40:34.087 <...> <...>: 2020-07-13 17:40:34.087 [3277] main/113/console/unix/: I> create index name on _vcollation
2020-07-13T17:40:34.087 <...> <...>: 2020-07-13 17:40:34.087 [3277] main/113/console/unix/: I> grant read access to 'public' role for _vcollation view
2020-07-13T17:40:34.088 <...> <...>: 2020-07-13 17:40:34.089 [3277] main/113/console/unix/: I> Update _func format
2020-07-13T17:40:34.103 <...> <...>: 2020-07-13 17:40:34.103 [3277] main/113/console/unix/: I> Create _func_index space
2020-07-13T17:40:34.103 <...> <...>: 2020-07-13 17:40:34.103 [3277] main/113/console/unix/: I> set schema version to 2.2.1
2020-07-13T17:40:34.103 <...> <...>: 2020-07-13 17:40:34.103 [3277] main/113/console/unix/: I> Create GREATEST and LEAST SQL Builtins
2020-07-13T17:40:34.104 <...> <...>: 2020-07-13 17:40:34.104 [3277] main/113/console/unix/: I> Extend _ck_constraint space format with is_enabled field
2020-07-13T17:40:34.104 <...> <...>: 2020-07-13 17:40:34.104 [3277] main/113/console/unix/: I> set schema version to 2.3.0
2020-07-13T17:40:34.104 <...> <...>: 2020-07-13 17:40:34.105 [3277] main/113/console/unix/: I> create space _session_settings
2020-07-13T17:40:34.104 <...> <...>: 2020-07-13 17:40:34.105 [3277] main/113/console/unix/: I> create index _session_settings:primary
2020-07-13T17:40:34.105 <...> <...>: 2020-07-13 17:40:34.105 [3277] main/113/console/unix/: I> set schema version to 2.3.1
2020-07-13T17:41:05.327 <...> <...>: 2020-07-13 17:41:05.327 [3277] main/173/main <...>.lua:251 E> <...>: stack traceback:
2020-07-13T17:41:05.327 <...> <...>:     /usr/local/share/tarantool/<...>.lua:455: in function </usr/local/share/tarantool/<...>.lua:453>
2020-07-13T17:41:05.327 <...> <...>:     [C]: in function '<...>'
2020-07-13T17:41:05.327 <...> <...>:     /usr/local/share/tarantool/<...>.lua:1904: in function '<...>'
2020-07-13T17:41:05.327 <...> <...>:     /usr/local/share/tarantool/<...>.lua:2009: in function </usr/local/share/tarantool/<...>.lua:2008>
2020-07-13T17:41:05.327 <...> <...>:     [C]: in function '<...>'
2020-07-13T17:41:05.327 <...> <...>:     /usr/local/share/tarantool/<...>.lua:2038: in function </usr/local/share/tarantool/<...>.lua:2033>
2020-07-13T17:41:05.327 <...> <...>:     [C]: at 0x004fa0f0 (455)
2020-07-13T17:41:05.327 <...> <...>: 2020-07-13 17:41:05.327 [3277] main/173/main <...>.lua:251 E> <...>: Tuple field 1 type does not match one required by operation: expected unsigned (457)

Добавили его руками через alter и все заработало.

После этого стали на время выполнения box.schema.update() снимать нагрузку, проблема не повторялась.

@kyukhin kyukhin modified the milestones: 2.7.1, wishlist Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Not ready to be implemented feature A new functionality upgrade
Projects
None yet
Development

No branches or pull requests

2 participants