diff --git a/CMakeLists.txt b/CMakeLists.txt index ecb3f1b43864edd4e81b7916ac808837cfa1d1b9..8065e380995063339a6a569a1c5ea925fa8c896a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,11 +3,8 @@ project(tarantool) include(CheckLibraryExists) include(CheckIncludeFile) include(CheckCCompilerFlag) -<<<<<<< HEAD include(CheckSymbolExists) -======= include(TestBigEndian) ->>>>>>> master-stable find_program(ECHO echo) find_program(CAT cat) find_program(GIT git) diff --git a/include/errcode.h b/include/errcode.h index f1609ad8916cfc9abcdc90690eb7d6d00ceee968..71d239557af148a0e94390773a95eeaf4a2e6f0c 100644 --- a/include/errcode.h +++ b/include/errcode.h @@ -73,7 +73,8 @@ struct errcode_record { /* 54 */_(ERR_CODE_UNUSED54, 0, "Unused54") \ /* 55 */_(ERR_CODE_NODE_FOUND, 2, "Node is found") \ /* 56 */_(ERR_CODE_INDEX_VIOLATION, 2, "Some index violation occur") \ - /* 57 */_(ERR_CODE_NO_SUCH_NAMESPACE, 2, "There is no such namespace") + /* 57 */_(ERR_CODE_NO_SUCH_NAMESPACE, 2, "There is no such namespace") \ + _(ERR_CODE_NO_SUCH_INDEX, 2, "No index with the given id is defined") ENUM0(tnt_error_codes_enum, ERROR_CODES); extern struct errcode_record tnt_error_codes[]; diff --git a/mod/box/box.m b/mod/box/box.m index eeed12b9dcbf0c56a93fdbb503990f142c760e70..7c5b805965628cbeb6f4da6998ee416be3287909 100644 --- a/mod/box/box.m +++ b/mod/box/box.m @@ -899,12 +899,12 @@ box_dispach(struct box_txn *txn, struct tbuf *data) if (i > MAX_IDX) tnt_raise(tnt_BoxException, - reason:"index too big" errcode:ERR_CODE_ILLEGAL_PARAMS); + reason:"index too big" errcode:ERR_CODE_NO_SUCH_INDEX); txn->index = &namespace[txn->n].index[i]; if (txn->index->key_cardinality == 0) tnt_raise(tnt_BoxException, reason:"index is invalid" - errcode:ERR_CODE_ILLEGAL_PARAMS); + errcode:ERR_CODE_NO_SUCH_INDEX); process_select(txn, limit, offset, data); break; diff --git a/test/box/protocol.c b/test/box/protocol.c index 5463ca5f0449616638100f9bfef63e15e3ec8ef1..6bc2e864a436b389966404ea8797607983ff4093 100644 --- a/test/box/protocol.c +++ b/test/box/protocol.c @@ -18,13 +18,13 @@ void test_ping() } +/** A test case for Bug#702397 + * https://bugs.launchpad.net/tarantool/+bug/702397 "If SELECT + * request specifies tuple count 0, no error" + */ + void test_bug702397() { - /* - * A test case for Bug#702397 - * https://bugs.launchpad.net/tarantool/+bug/702397 - * "If SELECT request specifies tuple count 0, no error" - */ const char message[]= { 0x11, 0x0, 0x0, 0x0, 0x14, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, @@ -36,6 +36,29 @@ void test_bug702397() tnt_errcode_desc(tnt_res.errcode >> 8)); } + +/** A test case for Bug#702399 + * https://bugs.launchpad.net/tarantool/+bug/702399 + * ERR_CODE_ILLEGAL_PARAMS is returned when there is no such key + */ + +void test_bug702399() +{ + const char message[]= { + 0x11, 0x0, 0x0, 0x0, 0x1d, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xff, 0xff, 0xff, 0xff, + 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, + 0x4, 0x1, 0x0, 0x0, 0x0 }; + struct tnt_result tnt_res; + int res = tnt_execute_raw(conn, message, sizeof message, &tnt_res); + printf("return_code: %s, %s\n", + tnt_errcode_str(tnt_res.errcode >> 8), + tnt_errcode_desc(tnt_res.errcode >> 8)); +} + + int main() { conn = tnt_connect("localhost", 33013); @@ -44,6 +67,7 @@ int main() test_ping(); test_bug702397(); + test_bug702399(); tnt_disconnect(conn); return 0; diff --git a/test/box/protocol.result b/test/box/protocol.result index 34a50786e7282da11da9e42f027ea52366d3e419..20c738386346dc379dccfdef1da43804dfe130c8 100644 --- a/test/box/protocol.result +++ b/test/box/protocol.result @@ -1,2 +1,3 @@ return_code: 0 return_code: ERR_CODE_ILLEGAL_PARAMS, "Illegal parameters" +return_code: ERR_CODE_NO_SUCH_INDEX, "No index with the given id is defined"