diff --git a/src/tarantool.c b/src/tarantool.c index ba46c65..30cccd9 100644 --- a/src/tarantool.c +++ b/src/tarantool.c @@ -271,7 +271,7 @@ static int __tarantool_connect(tarantool_object *t_obj) { while (count > 0) { --count; if (err) { - /* If we're here, then there war error */ + /* If we're here, then there was error */ nanosleep(&sleep_time, NULL); efree(err); err = NULL; @@ -301,7 +301,6 @@ static int __tarantool_connect(tarantool_object *t_obj) { } if (count == 0) { ioexception: - // raise (SIGABRT); tarantool_throw_ioexception("%s", err); efree(err); return FAILURE; diff --git a/src/tarantool_schema.c b/src/tarantool_schema.c index 842a4d5..01d7e6f 100644 --- a/src/tarantool_schema.c +++ b/src/tarantool_schema.c @@ -232,6 +232,8 @@ parse_schema_space_value_value(struct schema_field_value *fld, goto error; sfield = mp_decode_str(tuple, &sfield_len); fld->field_type = parse_field_type(sfield, sfield_len); + } else { + mp_next(tuple); } return 0; error: diff --git a/test/DMLTest.php b/test/DMLTest.php index 356c64f..e18809e 100644 --- a/test/DMLTest.php +++ b/test/DMLTest.php @@ -342,7 +342,7 @@ public function test_16_hash_select() { self::$tarantool->select("test_hash", null, null, null, null, TARANTOOL::ITERATOR_EQ); $this->assertFalse(True); } catch (TarantoolClientError $e) { - $this->assertContains('Invalid key part', $e->getMessage()); + $this->assertRegExp('(Invalid key part|via a partial key)', $e->getMessage()); } } @@ -354,7 +354,7 @@ public function test_17_01_it_clienterror($spc, $itype, $xcmsg) { self::$tarantool->select($spc, null, null, null, null, $itype); $this->assertFalse(True); } catch (TarantoolClientError $e) { - $this->assertContains($xcmsg, $e->getMessage()); + $this->assertRegExp($xcmsg, $e->getMessage()); } } @@ -384,40 +384,40 @@ public function test_17_03_it_good($spc, $itype) { public static function provideIteratorClientError() { return [ - ['test_hash', 'EQ' ,'Invalid key part'], - ['test_hash', 'REQ' ,'Invalid key part'], - ['test_hash', 'LT' ,'Invalid key part'], - ['test_hash', 'LE' ,'Invalid key part'], - ['test_hash', 'GE' ,'Invalid key part'], - ['test_hash', 'BITSET_ALL_SET' ,'Invalid key part'], - ['test_hash', 'BITSET_ANY_SET' ,'Invalid key part'], - ['test_hash', 'BITSET_ALL_NOT_SET','Invalid key part'], - ['test_hash', 'BITS_ALL_SET' ,'Invalid key part'], - ['test_hash', 'BITS_ANY_SET' ,'Invalid key part'], - ['test_hash', 'BITS_ALL_NOT_SET' ,'Invalid key part'], - ['test_hash', 'OVERLAPS' ,'Invalid key part'], - ['test_hash', 'NEIGHBOR' ,'Invalid key part'], - ['test_hash', 'eq' ,'Invalid key part'], - ['test_hash', 'req' ,'Invalid key part'], - ['test_hash', 'lt' ,'Invalid key part'], - ['test_hash', 'le' ,'Invalid key part'], - ['test_hash', 'ge' ,'Invalid key part'], - ['test_hash', 'bitset_all_set' ,'Invalid key part'], - ['test_hash', 'bitset_any_set' ,'Invalid key part'], - ['test_hash', 'bitset_all_not_set','Invalid key part'], - ['test_hash', 'bits_all_set' ,'Invalid key part'], - ['test_hash', 'bits_any_set' ,'Invalid key part'], - ['test_hash', 'bits_all_not_set' ,'Invalid key part'], - ['test_hash', 'overlaps' ,'Invalid key part'], - ['test_hash', 'neighbor' ,'Invalid key part'], - ['test' , 'bitset_all_set' ,'does not support requested iterator type'], - ['test' , 'bitset_any_set' ,'does not support requested iterator type'], - ['test' , 'bitset_all_not_set','does not support requested iterator type'], - ['test' , 'bits_all_set' ,'does not support requested iterator type'], - ['test' , 'bits_any_set' ,'does not support requested iterator type'], - ['test' , 'bits_all_not_set' ,'does not support requested iterator type'], - ['test' , 'overlaps' ,'does not support requested iterator type'], - ['test' , 'neighbor' ,'does not support requested iterator type'], + ['test_hash', 'EQ' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'REQ' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'LT' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'LE' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'GE' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'BITSET_ALL_SET' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'BITSET_ANY_SET' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'BITSET_ALL_NOT_SET','(Invalid key part|via a partial key)'], + ['test_hash', 'BITS_ALL_SET' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'BITS_ANY_SET' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'BITS_ALL_NOT_SET' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'OVERLAPS' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'NEIGHBOR' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'eq' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'req' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'lt' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'le' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'ge' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'bitset_all_set' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'bitset_any_set' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'bitset_all_not_set','(Invalid key part|via a partial key)'], + ['test_hash', 'bits_all_set' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'bits_any_set' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'bits_all_not_set' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'overlaps' ,'(Invalid key part|via a partial key)'], + ['test_hash', 'neighbor' ,'(Invalid key part|via a partial key)'], + ['test' , 'bitset_all_set' ,'(does not support requested iterator type)'], + ['test' , 'bitset_any_set' ,'(does not support requested iterator type)'], + ['test' , 'bitset_all_not_set','(does not support requested iterator type)'], + ['test' , 'bits_all_set' ,'(does not support requested iterator type)'], + ['test' , 'bits_any_set' ,'(does not support requested iterator type)'], + ['test' , 'bits_all_not_set' ,'(does not support requested iterator type)'], + ['test' , 'overlaps' ,'(does not support requested iterator type)'], + ['test' , 'neighbor' ,'(does not support requested iterator type)'], ]; } diff --git a/test/shared/box.lua b/test/shared/box.lua index 9612baf..3a64868 100755 --- a/test/shared/box.lua +++ b/test/shared/box.lua @@ -8,13 +8,27 @@ local json = require('json') local yaml = require('yaml') log.info(fio.cwd()) +log.info("admin: %s, primary: %s", os.getenv('ADMIN_PORT'), os.getenv('PRIMARY_PORT')) + +local compat = { + log = 'log', + memtx_memory = 'memtx_memory', + unsigned = 'unsigned', + string = 'string', +} + +if (tonumber(_TARANTOOL:split('-')[1]:split('.')[2]) < 7) then + compat.log = 'logger' + compat.memtx_memory = 'slab_alloc_arena' + compat.unsigned = 'NUM' + compat.string = 'STR' +end -require('console').listen(os.getenv('ADMIN_PORT')) box.cfg{ - listen = os.getenv('PRIMARY_PORT'), - log_level = 5, - logger = 'tarantool.log', - slab_alloc_arena = 0.2 + listen = os.getenv('PRIMARY_PORT'), + log_level = 5, + [compat.log] = 'tarantool.log', + [compat.memtx_memory] = 400 * 1024 * 1024 } box.once('initialization', function() @@ -27,25 +41,25 @@ box.once('initialization', function() local space = box.schema.space.create('test', { format = { - {type = 'STR', name = 'name'}, - {type = 'NUM', name = 's1'}, - {type = 'STR', name = 's2'}, + { type = compat.unsigned, name = 'field1', add_field = 1 }, + { type = compat.unsigned, name = 's1' }, + { type = compat.string, name = 's2' }, } }) space:create_index('primary', { type = 'TREE', unique = true, - parts = {1, 'NUM'} + parts = {1, compat.unsigned} }) space:create_index('secondary', { type = 'TREE', unique = false, - parts = {2, 'NUM', 3, 'STR'} + parts = {2, compat.unsigned, 3, compat.string} }) local space = box.schema.space.create('msgpack') space:create_index('primary', { - parts = {1, 'NUM'} + parts = {1, compat.unsigned} }) space:insert{1, 'float as key', { [2.7] = {1, 2, 3} @@ -74,7 +88,7 @@ box.once('initialization', function() local space = box.schema.space.create('pstring') space:create_index('primary', { - parts = {1, 'STR'} + parts = {1, compat.string} }) local yml = io.open(fio.pathjoin(fio.cwd(), "../test/shared/queue.yml")):read("*a") local tuple = yaml.decode(yml)[1] @@ -125,3 +139,6 @@ end function test_6(...) return ... end + +require('console').listen(os.getenv('ADMIN_PORT')) +