<HTML><BODY><div class="js-helper js-readmsg-msg"><style type="text/css"></style><div><div id="style_15845200330463681957_BODY"><div class="class_1584552031"><div>Hi,<br><br>Sergey, thanks for the review, I’ve made the changes as you suggested.<br> <div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px;"><span data-email="sergeyb@tarantool.org" data-name="Sergey Bronnikov" data-quote-id="1701365913061528907" data-timestamp="1584457200" data-type="sender">Вторник, 17 марта 2020, 18:00 +03:00 от Sergey Bronnikov <<a href="/compose?To=sergeyb@tarantool.org">sergeyb@tarantool.org</a>>:<br> </span><div data-quote-id="1701365913061528907" data-type="body"><div id=""><div class="js-helper_mailru_css_attribute_postfix js-readmsg-msg_mailru_css_attribute_postfix"><style type="text/css"></style><div><div id="style_15844572491692822125_BODY_mailru_css_attribute_postfix">Hi,<br><br>comments inline<br><br>On 19:19 Mon 16 Mar , Alexander V. Tikhonov wrote:<br>> Divided into tests:<br>> - box/ddl_alter.test.lua<br>> - box/ddl_collation.test.lua<br>> - box/ddl_collation_types.test.lua<br>> - box/ddl_collation_wrong_id.test.lua<br>> - box/ddl_no_collation.test.lua<br>> - box/ddl_parallel.test.lua<br>> - box/ddl_tuple.test.lua<br>> - box/gh-2336-ddl_call_twice.test.lua<br>> - box/gh-2783-ddl_lock.test.lua<br>> - box/gh-2839-ddl_custom_fields.test.lua<br>> - box/gh-2937-ddl_collation_field_def.test.lua<br>> - box/gh-3290-ddl_collation_deleted.test.lua<br>> - box/gh-928-ddl_truncate.test.lua<br>> ---<br>><br>> Github: <a href="https://github.com/tarantool/tarantool/tree/avtikhon/divide_tests" rel="noopener noreferrer" target="_blank">https://github.com/tarantool/tarantool/tree/avtikhon/divide_tests</a><br><br>> diff --git a/test/box/ddl_alter.test.lua b/test/box/ddl_alter.test.lua<br>> new file mode 100644<br>> index 000000000..84c25abdb<br>> --- /dev/null<br>> +++ b/test/box/ddl_alter.test.lua<br>> @@ -0,0 +1,12 @@<br>> +env = require('test_run')<br>> +test_run = env.new()<br><br>unused variables</div></div></div></div></div></blockquote></div></div></div></div></div></div><div>Removed.</div><div class="js-helper js-readmsg-msg"><div><div><div class="class_1584552031"><div><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px;"><div data-quote-id="1701365913061528907" data-type="body"><div><div class="js-helper_mailru_css_attribute_postfix js-readmsg-msg_mailru_css_attribute_postfix"><div><div><br>> +-- index should not crash after alter<br>> +space = box.schema.space.create('test_swap')<br>> +index = space:create_index('pk')<br>> +space:replace({1, 2, 3})<br>> +index:rename('primary')<br>> +index2 = space:create_index('sec')<br>> +space:replace({2, 3, 1})<br>> +space:select()<br>> +space:drop()<br><br>> diff --git a/test/box/ddl_collation_types.test.lua b/test/box/ddl_collation_types.test.lua<br>> new file mode 100644<br>> index 000000000..478530537<br>> --- /dev/null<br>> +++ b/test/box/ddl_collation_types.test.lua<br>> @@ -0,0 +1,9 @@<br>> +env = require('test_run')<br>> +test_run = env.new()<br><br>unused variables</div></div></div></div></div></blockquote></div></div></div></div></div></div><div>Removed.</div><div class="js-helper js-readmsg-msg"><div><div><div class="class_1584552031"><div><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px;"><div data-quote-id="1701365913061528907" data-type="body"><div><div class="js-helper_mailru_css_attribute_postfix js-readmsg-msg_mailru_css_attribute_postfix"><div><div>> +-- Check that collation is allowed only for strings, scalar and any types.<br>> +format = {}<br>> +format[1] = {'field1', 'unsigned', collation = 'unicode'}<br>> +s = box.schema.create_space('test', {format = format})<br>> +format[1] = {'field2', 'array', collation = 'unicode_ci'}<br>> +s = box.schema.create_space('test', {format = format})<br><br>missed cleanup here</div></div></div></div></div></blockquote></div></div></div></div></div></div><div>Not needed due to non of the spaces created.</div><div class="js-helper js-readmsg-msg"><div><div><div class="class_1584552031"><div><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px;"><div data-quote-id="1701365913061528907" data-type="body"><div><div class="js-helper_mailru_css_attribute_postfix js-readmsg-msg_mailru_css_attribute_postfix"><div><div><br>> diff --git a/test/box/ddl_collation_wrong_id.test.lua b/test/box/ddl_collation_wrong_id.test.lua<br>> new file mode 100644<br>> index 000000000..0aaab322d<br>> --- /dev/null<br>> +++ b/test/box/ddl_collation_wrong_id.test.lua<br>> @@ -0,0 +1,10 @@<br>> +env = require('test_run')<br>> +test_run = env.new()<br><br>unused variables</div></div></div></div></div></blockquote></div></div></div></div></div></div><div>Removed.</div><div class="js-helper js-readmsg-msg"><div><div><div class="class_1584552031"><div><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px;"><div data-quote-id="1701365913061528907" data-type="body"><div><div class="js-helper_mailru_css_attribute_postfix js-readmsg-msg_mailru_css_attribute_postfix"><div><div>> +-- Check that error is raised when collation with wrong id is used.<br>> +_space = box.space[box.schema.SPACE_ID]<br>> +utils = require('utils')<br>> +EMPTY_MAP = utils.setmap({})<br>> +format = {{name = 'field1', type = 'string', collation = 666}}<br>> +surrogate_space = {12345, 1, 'test', 'memtx', 0, EMPTY_MAP, format}<br>> +_space:insert(surrogate_space)<br><br>missed cleanup</div></div></div></div></div></blockquote></div></div></div></div></div></div><div>Neither the original code had cleanup neither it could be added here, because of the error:<br> - error: Can't drop the primary key in a system space, space '_space'</div><div class="js-helper js-readmsg-msg"><div><div><div class="class_1584552031"><div><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px;"><div data-quote-id="1701365913061528907" data-type="body"><div><div class="js-helper_mailru_css_attribute_postfix js-readmsg-msg_mailru_css_attribute_postfix"><div><div><br>> diff --git a/test/box/ddl_no_collation.test.lua b/test/box/ddl_no_collation.test.lua<br>> new file mode 100644<br>> index 000000000..a5fdedd02<br>> --- /dev/null<br>> +++ b/test/box/ddl_no_collation.test.lua<br>> @@ -0,0 +1,7 @@<br>> +env = require('test_run')<br>> +test_run = env.new()<br>> +<br>> +-- Check that error is raised when collation doesn't exists.<br>> +format = {}<br>> +format[1] = {'field1', 'unsigend', collation = 'test_coll'}<br>> +s = box.schema.create_space('test', {format = format})<br><br>> diff --git a/test/box/ddl_parallel.test.lua b/test/box/ddl_parallel.test.lua<br>> new file mode 100644<br>> index 000000000..99c3bfdcc<br>> --- /dev/null<br>> +++ b/test/box/ddl_parallel.test.lua<br>> @@ -0,0 +1,30 @@<br>> +env = require('test_run')<br>> +test_run = env.new()<br>> +<br>> +fiber = require'fiber'<br>> +<br>> +-- simple test for parallel ddl execution<br>> +_ = box.schema.space.create('test'):create_index('pk')<br>> +<br>> +ch = fiber.channel(2)<br>> +<br>> +test_run:cmd("setopt delimiter ';'")<br>> +<br>> +function f1()<br>> + box.space.test:create_index('sec', {parts = {2, 'num'}})<br>> + ch:put(true)<br>> +end;<br>> +<br>> +function f2()<br>> + box.space.test:create_index('third', {parts = {3, 'string'}})<br>> + ch:put(true)<br>> +end;<br>> +<br>> +test_run:cmd("setopt delimiter ''");<br>> +<br>> +_ = {fiber.create(f1), fiber.create(f2)}<br>> +<br>> +ch:get()<br>> +ch:get()<br>> +<br>> +_ = box.space.test:drop()<br>> diff --git a/test/box/ddl_tuple.result b/test/box/ddl_tuple.result<br>> new file mode 100644<br>> index 000000000..6a024a833<br>> --- /dev/null<br>> +++ b/test/box/ddl_tuple.result<br>> @@ -0,0 +1,67 @@<br>> +-- test-run result file version 2<br>> +env = require('test_run')<br>> + | ---<br>> + | ...<br>> +test_run = env.new()<br>> + | ---<br>> + | ...<br>> +<br>> +fiber = require'fiber'<br>> + | ---<br>> + | ...<br>> +ch = fiber.channel(3)<br>> + | ---<br>> + | ...<br>> +<br>> +_ = box.schema.space.create('test'):create_index('pk')<br>> + | ---<br>> + | ...<br>> +<br>> +test_run:cmd("setopt delimiter ';'")<br>> + | ---<br>> + | - true<br>> + | ...<br>> +function add_index()<br>> + box.space.test:create_index('sec', {parts = {2, 'num'}})<br>> + ch:put(true)<br>> +end;<br>> + | ---<br>> + | ...<br>> +<br>> +function insert_tuple(tuple)<br>> + ch:put({pcall(box.space.test.replace, box.space.test, tuple)})<br>> +end;<br>> + | ---<br>> + | ...<br>> +test_run:cmd("setopt delimiter ''");<br>> + | ---<br>> + | - true<br>> + | ...<br>> +<br>> +_ = {fiber.create(insert_tuple, {1, 2, 'a'}), fiber.create(add_index), fiber.create(insert_tuple, {2, '3', 'b'})}<br>> + | ---<br>> + | ...<br>> +{ch:get(), ch:get(), ch:get()}<br>> + | ---<br>> + | - - - false<br>> + | - 'Tuple field 2 type does not match one required by operation: expected unsigned'<br>> + | - - true<br>> + | - [1, 2, 'a']<br>> + | - true<br>> + | ...<br>> +<br>> +box.space.test:select()<br>> + | ---<br>> + | - - [1, 2, 'a']<br>> + | ...<br>> +<br>> +test_run:cmd('restart server default')<br>> + |<br>> +<br>> +box.space.test:select()<br>> + | ---<br>> + | - - [1, 2, 'a']<br>> + | ...<br>> +box.space.test:drop()<br>> + | ---<br>> + | ...<br>> diff --git a/test/box/ddl_tuple.test.lua b/test/box/ddl_tuple.test.lua<br>> new file mode 100644<br>> index 000000000..1c78a00e4<br>> --- /dev/null<br>> +++ b/test/box/ddl_tuple.test.lua<br>> @@ -0,0 +1,28 @@<br>> +env = require('test_run')<br>> +test_run = env.new()<br>> +<br>> +fiber = require'fiber'<br>> +ch = fiber.channel(3)<br>> +<br>> +_ = box.schema.space.create('test'):create_index('pk')<br>> +<br>> +test_run:cmd("setopt delimiter ';'")<br>> +function add_index()<br>> + box.space.test:create_index('sec', {parts = {2, 'num'}})<br>> + ch:put(true)<br>> +end;<br>> +<br>> +function insert_tuple(tuple)<br>> + ch:put({pcall(box.space.test.replace, box.space.test, tuple)})<br>> +end;<br>> +test_run:cmd("setopt delimiter ''");<br>> +<br>> +_ = {fiber.create(insert_tuple, {1, 2, 'a'}), fiber.create(add_index), fiber.create(insert_tuple, {2, '3', 'b'})}<br>> +{ch:get(), ch:get(), ch:get()}<br>> +<br>> +box.space.test:select()<br>> +<br>> +test_run:cmd('restart server default')<br>> +<br>> +box.space.test:select()<br>> +box.space.test:drop()<br>> diff --git a/test/box/gh-2336-ddl_call_twice.result b/test/box/gh-2336-ddl_call_twice.result<br>> new file mode 100644<br>> index 000000000..aa4dee54b<br>> --- /dev/null<br>> +++ b/test/box/gh-2336-ddl_call_twice.result<br>> @@ -0,0 +1,51 @@<br>> +-- test-run result file version 2<br>> +env = require('test_run')<br>> + | ---<br>> + | ...<br>> +test_run = env.new()<br>> + | ---<br>> + | ...<br>> +<br>> +-- gh-2336 crash if format called twice during snapshot<br>> +fiber = require'fiber'<br>> + | ---<br>> + | ...<br>> +<br>> +space = box.schema.space.create('test_format')<br>> + | ---<br>> + | ...<br>> +_ = space:create_index('pk', { parts = { 1,'str' }})<br>> + | ---<br>> + | ...<br>> +space:format({{ name ="key"; type = "string" }, { name ="dataAB"; type = "string" }})<br>> + | ---<br>> + | ...<br>> +str = string.rep("t",1024)<br>> + | ---<br>> + | ...<br>> +for i = 1, 10000 do space:insert{tostring(i), str} end<br>> + | ---<br>> + | ...<br>> +ch = fiber.channel(3)<br>> + | ---<br>> + | ...<br>> +_ = fiber.create(function() fiber.yield() box.snapshot() ch:put(true) end)<br>> + | ---<br>> + | ...<br>> +format = {{name ="key"; type = "string"}, {name ="data"; type = "string"}}<br>> + | ---<br>> + | ...<br>> +for i = 1, 2 do fiber.create(function() fiber.yield() space:format(format) ch:put(true) end) end<br>> + | ---<br>> + | ...<br>> +<br>> +{ch:get(), ch:get(), ch:get()}<br>> + | ---<br>> + | - - true<br>> + | - true<br>> + | - true<br>> + | ...<br>> +<br>> +space:drop()<br>> + | ---<br>> + | ...<br>> diff --git a/test/box/gh-2336-ddl_call_twice.test.lua b/test/box/gh-2336-ddl_call_twice.test.lua<br>> new file mode 100644<br>> index 000000000..cf187c1bd<br>> --- /dev/null<br>> +++ b/test/box/gh-2336-ddl_call_twice.test.lua<br>> @@ -0,0 +1,19 @@<br>> +env = require('test_run')<br>> +test_run = env.new()<br>> +<br>> +-- gh-2336 crash if format called twice during snapshot<br>> +fiber = require'fiber'<br>> +<br>> +space = box.schema.space.create('test_format')<br>> +_ = space:create_index('pk', { parts = { 1,'str' }})<br>> +space:format({{ name ="key"; type = "string" }, { name ="dataAB"; type = "string" }})<br>> +str = string.rep("t",1024)<br>> +for i = 1, 10000 do space:insert{tostring(i), str} end<br>> +ch = fiber.channel(3)<br>> +_ = fiber.create(function() fiber.yield() box.snapshot() ch:put(true) end)<br>> +format = {{name ="key"; type = "string"}, {name ="data"; type = "string"}}<br>> +for i = 1, 2 do fiber.create(function() fiber.yield() space:format(format) ch:put(true) end) end<br>> +<br>> +{ch:get(), ch:get(), ch:get()}<br>> +<br>> +space:drop()<br><br><br>> diff --git a/test/box/gh-2783-ddl_lock.test.lua b/test/box/gh-2783-ddl_lock.test.lua<br>> new file mode 100644<br>> index 000000000..953e177a7<br>> --- /dev/null<br>> +++ b/test/box/gh-2783-ddl_lock.test.lua<br>> @@ -0,0 +1,33 @@<br>> +env = require('test_run')<br>> +test_run = env.new()<br>> +<br>> +--<br>> +-- gh-2783<br>> +-- A ddl operation shoud fail before trying to lock a ddl latch<br>> +-- in a multi-statement transaction.<br>> +-- If operation tries to lock already an locked latch then the<br>> +-- current transaction will be silently rolled back under our feet.<br>> +-- This is confusing. So check for multi-statement transaction<br>> +-- before locking the latch.<br>> +--<br>> +test_latch = box.schema.space.create('test_latch')<br>> +_ = test_latch:create_index('primary', {unique = true, parts = {1, 'unsigned'}})<br>> +fiber = require('fiber')<br>> +c = fiber.channel(1)<br>> +test_run:cmd("setopt delimiter ';'")<br>> +_ = fiber.create(function()<br>> + test_latch:create_index("sec", {unique = true, parts = {2, 'unsigned'}})<br>> + c:put(true)<br>> +end);<br>> +<br>> +-- Should be Ok for now<br>> +box.begin()<br>> + test_latch:create_index("sec2", {unique = true, parts = {2, 'unsigned'}})<br>> +box.commit();<br>> +test_run:cmd("setopt delimiter ''");<br>> +-- Explicitly roll back the transaction in multi-statement,<br>> +-- which hasn't finished due to DDL error<br>> +box.rollback()<br>> +<br>> +_ = c:get()<br>> +test_latch:drop() -- this is where everything stops<br><br><br>> diff --git a/test/box/gh-2839-ddl_custom_fields.test.lua b/test/box/gh-2839-ddl_custom_fields.test.lua<br>> new file mode 100644<br>> index 000000000..5f0cb243f<br>> --- /dev/null<br>> +++ b/test/box/gh-2839-ddl_custom_fields.test.lua<br>> @@ -0,0 +1,13 @@<br>> +env = require('test_run')<br>> +test_run = env.new()<br><br>unused variables</div></div></div></div></div></blockquote></div></div></div></div></div></div><div>Removed.</div><div class="js-helper js-readmsg-msg"><div><div><div class="class_1584552031"><div><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px;"><div data-quote-id="1701365913061528907" data-type="body"><div><div class="js-helper_mailru_css_attribute_postfix js-readmsg-msg_mailru_css_attribute_postfix"><div><div><br>> +-- gh-2839: allow to store custom fields in field definition.<br>> +--<br>> +format = {}<br>> +format[1] = {name = 'field1', type = 'unsigned'}<br>> +format[2] = {'field2', 'unsigned'}<br>> +format[3] = {'field3', 'unsigned', custom_field = 'custom_value'}<br>> +s = box.schema.create_space('test', {format = format})<br>> +s:format()[3].custom_field<br>> +s:drop()<br><br><br>> diff --git a/test/box/gh-2937-ddl_collation_field_def.test.lua b/test/box/gh-2937-ddl_collation_field_def.test.lua<br>> new file mode 100644<br>> index 000000000..0906afebd<br>> --- /dev/null<br>> +++ b/test/box/gh-2937-ddl_collation_field_def.test.lua<br>> @@ -0,0 +1,13 @@<br>> +env = require('test_run')<br>> +test_run = env.new()<br><br>unused variables</div></div></div></div></div></blockquote></div></div></div></div></div></div><div>Removed.</div><div class="js-helper js-readmsg-msg"><div><div><div class="class_1584552031"><div><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px;"><div data-quote-id="1701365913061528907" data-type="body"><div><div class="js-helper_mailru_css_attribute_postfix js-readmsg-msg_mailru_css_attribute_postfix"><div><div>> +<br>> +--<br>> +-- gh-2937: allow to specify collation in field definition.<br>> +--<br>> +format = {}<br>> +format[1] = {name = 'field1', type = 'string', collation = 'unicode'}<br>> +format[2] = {'field2', 'any', collation = 'unicode_ci'}<br>> +format[3] = {type = 'scalar', name = 'field3', collation = 'unicode'}<br>> +s = box.schema.create_space('test', {format = format})<br>> +s:format()<br>> +s:drop()<br><br>> diff --git a/test/box/gh-3290-ddl_collation_deleted.test.lua b/test/box/gh-3290-ddl_collation_deleted.test.lua<br>> new file mode 100644<br>> index 000000000..f36838e7a<br>> --- /dev/null<br>> +++ b/test/box/gh-3290-ddl_collation_deleted.test.lua<br>> @@ -0,0 +1,10 @@<br>> +env = require('test_run')<br>> +test_run = env.new()<br><br>unused variables</div></div></div></div></div></blockquote></div></div></div></div></div></div><div>Removed.</div><div class="js-helper js-readmsg-msg"><div><div><div class="class_1584552031"><div><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px;"><div data-quote-id="1701365913061528907" data-type="body"><div><div class="js-helper_mailru_css_attribute_postfix js-readmsg-msg_mailru_css_attribute_postfix"><div><div>> +--<br>> +-- gh-3290: expose ICU into Lua. It uses built-in collations, that<br>> +-- must work even if a collation is deleted from _collation.<br>> +--<br>> +t = box.space._collation:delete{1}<br>> +utf8.cmp('abc', 'def')<br>> +box.space._collation:replace(t)<br><br>missed cleanup</div></div></div></div></div></blockquote></div></div></div></div></div></div><div>Seems that no need in cleanup here.</div><div class="js-helper js-readmsg-msg"><div><div><div class="class_1584552031"><div><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px;"><div data-quote-id="1701365913061528907" data-type="body"><div><div class="js-helper_mailru_css_attribute_postfix js-readmsg-msg_mailru_css_attribute_postfix"><div><div><br><br>> diff --git a/test/box/gh-928-ddl_truncate.test.lua b/test/box/gh-928-ddl_truncate.test.lua<br>> new file mode 100644<br>> index 000000000..304cc2cfc<br>> --- /dev/null<br>> +++ b/test/box/gh-928-ddl_truncate.test.lua<br>> @@ -0,0 +1,17 @@<br>> +env = require('test_run')<br>> +test_run = env.new()<br><br>unused variables</div></div></div></div></div></blockquote></div></div></div></div></div></div><div>Removed.</div><div class="js-helper js-readmsg-msg"><div><div><div class="class_1584552031"><div><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px;"><div data-quote-id="1701365913061528907" data-type="body"><div><div class="js-helper_mailru_css_attribute_postfix js-readmsg-msg_mailru_css_attribute_postfix"><div><div>> +fiber = require'fiber'<br>> +ch = fiber.channel(2)<br>> +<br>> +--issue #928<br>> +space = box.schema.space.create('test_trunc')<br>> +_ = space:create_index('pk')<br>> +_ = box.space.test_trunc:create_index('i1', {type = 'hash', parts = {2, 'STR'}})<br>> +_ = box.space.test_trunc:create_index('i2', {type = 'hash', parts = {2, 'STR'}})<br>> +<br>> +function test_trunc() space:truncate() ch:put(true) end<br>> +<br>> +_ = {fiber.create(test_trunc), fiber.create(test_trunc)}<br>> +_ = {ch:get(), ch:get()}<br>> +space:drop()<br>> --<br>> 2.17.1<br>><br><br>--<br>sergeyb@</div></div></div></div></div></blockquote></div> <div> </div><div data-signature-widget="container"><div data-signature-widget="content"><div>--<br>Alexander Tikhonov</div></div></div><div> </div></div></div></div></div></div><div> </div></BODY></HTML>