[server 3/4] iproto: add IPROTO_NOP request type
Konstantin Osipov
kostja at tarantool.org
Thu Jan 25 23:58:50 MSK 2018
* Vladimir Davydov <vdavydov.dev at gmail.com> [18/01/23 21:09]:
> Needed for #2993
> ---
> src/box/iproto.cc | 3 ++-
> src/box/iproto_constants.c | 5 ++++-
> src/box/iproto_constants.h | 11 ++++++++++-
> 3 files changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/src/box/iproto.cc b/src/box/iproto.cc
> index 13594a46..5dfb2b83 100644
> --- a/src/box/iproto.cc
> +++ b/src/box/iproto.cc
> @@ -913,7 +913,8 @@ static const struct cmsg_hop *dml_route[IPROTO_TYPE_STAT_MAX] = {
> misc_route, /* IPROTO_AUTH */
> call_route, /* IPROTO_EVAL */
> process1_route, /* IPROTO_UPSERT */
> - call_route /* IPROTO_CALL */
> + call_route, /* IPROTO_CALL */
> + NULL, /* IPROTO_NOP */
Why NOP and not NOOP?
> diff --git a/src/box/iproto_constants.h b/src/box/iproto_constants.h
> index e1192e91..94b111ad 100644
> --- a/src/box/iproto_constants.h
> +++ b/src/box/iproto_constants.h
> @@ -141,6 +141,8 @@ enum iproto_type {
> IPROTO_UPSERT = 9,
> /** CALL request - returns arbitrary MessagePack */
> IPROTO_CALL = 10,
> + /** No operation. Treated as DML, used to bump LSN. */
> + IPROTO_NOP = 11,
> /** The maximum typecode used for box.stat() */
> IPROTO_TYPE_STAT_MAX,
I thought we agreed to keep IPROTO_TYPE_STAT_MAX at 10 and
introduce a different constant for iproto_type_name(), something
like IRPOTO_TYPE_NAME_MAX?
> @@ -174,6 +176,13 @@ extern const char *iproto_type_strs[];
> static inline const char *
> iproto_type_name(uint32_t type)
> {
> + /*
> + * Sic: iptoto_type_strs[IPROTO_NOP] is NULL
> + * to suppress box.stat() output.
> + */
> + if (type == IPROTO_NOP)
> + return "NOP";
> +
> if (type < IPROTO_TYPE_STAT_MAX)
> return iproto_type_strs[type];
With this new constant this piece would look less ugly.
>
> @@ -207,7 +216,7 @@ static inline bool
> iproto_type_is_dml(uint32_t type)
> {
> return (type >= IPROTO_SELECT && type <= IPROTO_DELETE) ||
> - type == IPROTO_UPSERT;
> + type == IPROTO_UPSERT || type == IPROTO_NOP;
> }
OK.
--
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.org - www.twitter.com/kostja_osipov
More information about the Tarantool-patches
mailing list