diff --git a/mod/box/box.m b/mod/box/box.m index 796269ad9e11bd1b006e63f2373c12848c34bfb1..f744cb6e2890b6ed51f8932d264451e5d6f6f26c 100644 --- a/mod/box/box.m +++ b/mod/box/box.m @@ -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); } } diff --git a/mod/box/request.h b/mod/box/request.h index ef739b580baaab93cd55c377802aac8c8dd74e09..4fb103b8a8a3927b663b346895b60e9826f0561e 100644 --- a/mod/box/request.h +++ b/mod/box/request.h @@ -100,6 +100,8 @@ request_is_select(u32 type) return type == SELECT || type == CALL; } +const char *request_name(u32 type); + struct request { u32 type; diff --git a/mod/box/request.m b/mod/box/request.m index ac0ac4a56abbe12b52457d4759dddf0810ae4153..8a45cdf8f37df24616f1ee632013bec1d64c0c2b 100644 --- a/mod/box/request.m +++ b/mod/box/request.m @@ -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;