Skip to content
Snippets Groups Projects
Commit 2d9b148e authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

Merge branch Bug#702399 into master-stable.

Conflicts:
	include/iproto.h
	test/box/protocol.c
	test/box/protocol.result
parents cab962b6 34fd4a71
No related merge requests found
......@@ -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[];
......
......@@ -812,10 +812,10 @@ box_dispach(struct box_txn *txn, enum box_mode mode, u16 op, struct tbuf *data)
u32 limit = read_u32(data);
if (i > MAX_IDX)
box_raise(ERR_CODE_ILLEGAL_PARAMS, "index too big");
box_raise(ERR_CODE_NO_SUCH_INDEX, "index too big");
txn->index = &namespace[txn->n].index[i];
if (txn->index->key_cardinality == 0)
box_raise(ERR_CODE_ILLEGAL_PARAMS, "index is invalid");
box_raise(ERR_CODE_NO_SUCH_INDEX, "index is invalid");
stat_collect(stat_base, op, 1);
return process_select(txn, limit, offset, data);
......
......@@ -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;
......
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"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment