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

Don't crash when trying to print a too long unsupported request.

parent 41ef4182
No related branches found
No related tags found
No related merge requests found
......@@ -98,7 +98,7 @@ box_process_rw(struct txn *txn, struct port *port,
stop = ev_now();
if (stop - start > cfg.too_long_threshold)
say_warn("too long %s: %.3f sec",
requests_strs[op], stop - start);
request_name(op), stop - start);
}
}
......
......@@ -100,6 +100,8 @@ request_is_select(u32 type)
return type == SELECT || type == CALL;
}
const char *request_name(u32 type);
struct request
{
u32 type;
......
......@@ -817,22 +817,30 @@ execute_delete(struct request *request, struct txn *txn, struct port *port)
* We must collect stats before execute.
* Check request type here for now.
*/
static void
static bool
request_check_type(u32 type)
{
if (type != REPLACE && type != SELECT &&
type != UPDATE && type != DELETE_1_3 &&
type != DELETE && type != CALL) {
return (type != REPLACE && type != SELECT &&
type != UPDATE && type != DELETE_1_3 &&
type != DELETE && type != CALL);
}
say_error("Unsupported request = %" PRIi32 "", type);
tnt_raise(IllegalParams, :"unsupported command code, "
"check the error log");
}
const char *
request_name(u32 type)
{
if (request_check_type(type))
return "unsupported";
return requests_strs[type];
}
struct request *
request_create(u32 type, struct tbuf *data)
{
if (request_check_type(type)) {
say_error("Unsupported request = %" PRIi32 "", type);
tnt_raise(IllegalParams, :"unsupported command code, "
"check the error log");
}
request_check_type(type);
struct request *request = palloc(fiber->gc_pool, sizeof(struct request));
request->type = type;
......
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