Skip to content

Fixing problem caused by non-server fields in space :format() #132

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

Merged
merged 1 commit into from
May 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/tarantool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/tarantool_schema.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
72 changes: 36 additions & 36 deletions test/DMLTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

Expand All @@ -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());
}
}

Expand Down Expand Up @@ -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)'],
];
}

Expand Down
41 changes: 29 additions & 12 deletions test/shared/box.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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}
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -125,3 +139,6 @@ end
function test_6(...)
return ...
end

require('console').listen(os.getenv('ADMIN_PORT'))