Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: kostja@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: [PATCH 3/6] iproto: fix IPROTO_SERVER_IS_RO key code
Date: Wed, 13 Jun 2018 19:10:35 +0300	[thread overview]
Message-ID: <23a6cf92394dd7f5b8d32e5bfd548897ae0ead92.1528906027.git.vdavydov.dev@gmail.com> (raw)
In-Reply-To: <cover.1528906027.git.vdavydov.dev@gmail.com>
In-Reply-To: <cover.1528906027.git.vdavydov.dev@gmail.com>

IPROTO_SERVER_IS_RO currently has code 0x07 and is defined in the header
key section, which is wrong, because this key is only used in request
body. Let's move it to the body section, where it belongs, and set its
code to 0x29. This shouldn't break anything even if 0x07 is reused in
future, because the two codes belong to different sections and hence are
never parsed in the same function. Worst that can happen is we fail to
bootstrap a node in the cluster if it is running a newer tarantool
version.

While we are at it, let's also add the key name and change its type from
MP_UINT to MP_BOOL.

Fixes commit a8ecd1e122ae ("replication: fix bug with read-only replica
as a bootstrap leader").
---
 src/box/iproto_constants.c | 5 +++--
 src/box/iproto_constants.h | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/box/iproto_constants.c b/src/box/iproto_constants.c
index 6dba85f5..3adb7cd4 100644
--- a/src/box/iproto_constants.c
+++ b/src/box/iproto_constants.c
@@ -40,10 +40,10 @@ const unsigned char iproto_key_type[IPROTO_KEY_MAX] =
 		/* 0x04 */	MP_DOUBLE, /* IPROTO_TIMESTAMP */
 		/* 0x05 */	MP_UINT,   /* IPROTO_SCHEMA_VERSION */
 		/* 0x06 */	MP_UINT,   /* IPROTO_SERVER_VERSION */
-		/* 0x07 */	MP_UINT,   /* IPROTO_SERVER_IS_RO */
 	/* }}} */
 
 	/* {{{ unused */
+		/* 0x07 */	MP_UINT,
 		/* 0x08 */	MP_UINT,
 		/* 0x09 */	MP_UINT,
 		/* 0x0a */	MP_UINT,
@@ -86,6 +86,7 @@ const unsigned char iproto_key_type[IPROTO_KEY_MAX] =
 	/* 0x26 */	MP_MAP, /* IPROTO_VCLOCK */
 	/* 0x27 */	MP_STR, /* IPROTO_EXPR */
 	/* 0x28 */	MP_ARRAY, /* IPROTO_OPS */
+	/* 0x29 */	MP_BOOL, /* IPROTO_SERVER_IS_RO */
 	/* }}} */
 };
 
@@ -166,7 +167,7 @@ const char *iproto_key_strs[IPROTO_KEY_MAX] = {
 	"vector clock",     /* 0x26 */
 	"expression",       /* 0x27 */
 	"operations",       /* 0x28 */
-	NULL,               /* 0x29 */
+	"server is ro",     /* 0x29 */
 	NULL,               /* 0x2a */
 	NULL,               /* 0x2b */
 	NULL,               /* 0x2c */
diff --git a/src/box/iproto_constants.h b/src/box/iproto_constants.h
index dd50bf87..d1320de7 100644
--- a/src/box/iproto_constants.h
+++ b/src/box/iproto_constants.h
@@ -58,7 +58,6 @@ enum iproto_key {
 	IPROTO_TIMESTAMP = 0x04,
 	IPROTO_SCHEMA_VERSION = 0x05,
 	IPROTO_SERVER_VERSION = 0x06,
-	IPROTO_SERVER_IS_RO = 0x07,
 	/* Leave a gap for other keys in the header. */
 	IPROTO_SPACE_ID = 0x10,
 	IPROTO_INDEX_ID = 0x11,
@@ -77,6 +76,7 @@ enum iproto_key {
 	IPROTO_VCLOCK = 0x26,
 	IPROTO_EXPR = 0x27, /* EVAL */
 	IPROTO_OPS = 0x28, /* UPSERT but not UPDATE ops, because of legacy */
+	IPROTO_SERVER_IS_RO = 0x29,
 	/* Leave a gap between request keys and response keys */
 	IPROTO_DATA = 0x30,
 	IPROTO_ERROR = 0x31,
-- 
2.11.0

  parent reply	other threads:[~2018-06-13 16:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-13 16:10 [PATCH 0/6] Introduce replica local spaces Vladimir Davydov
2018-06-13 16:10 ` [PATCH 1/6] txn: remove unused C++ wrappers Vladimir Davydov
2018-06-27 17:08   ` Konstantin Osipov
2018-06-13 16:10 ` [PATCH 2/6] xrow: fix ret code on decode failure Vladimir Davydov
2018-06-27 17:29   ` Konstantin Osipov
2018-06-13 16:10 ` Vladimir Davydov [this message]
2018-06-27 17:48   ` [PATCH 3/6] iproto: fix IPROTO_SERVER_IS_RO key code Konstantin Osipov
2018-06-13 16:10 ` [PATCH 4/6] txn: do not require space id for nop requests Vladimir Davydov
2018-06-27 17:45   ` Konstantin Osipov
2018-06-28  9:13     ` Vladimir Davydov
2018-06-28 10:23       ` Konstantin Osipov
2018-06-28 10:35         ` Vladimir Davydov
2018-06-28 10:54           ` Konstantin Osipov
2018-06-28 11:10             ` Vladimir Davydov
2018-06-13 16:10 ` [PATCH 5/6] xrow: make NOP requests bodiless Vladimir Davydov
2018-06-27 17:49   ` Konstantin Osipov
2018-06-13 16:10 ` [PATCH 6/6] Introduce replica local spaces Vladimir Davydov
2018-06-13 21:26   ` [tarantool-patches] " Vladislav Shpilevoy
2018-06-27 18:24   ` Konstantin Osipov
2018-06-27 18:27   ` Konstantin Osipov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=23a6cf92394dd7f5b8d32e5bfd548897ae0ead92.1528906027.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH 3/6] iproto: fix IPROTO_SERVER_IS_RO key code' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox