Tarantool development patches archive
 help / color / mirror / Atom feed
From: Cyrill Gorcunov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: tml <tarantool-patches@dev.tarantool.org>
Cc: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: [Tarantool-patches] [PATCH] iproto: stringify IPROTO_RAFT, IPROTO_PROMOTE
Date: Fri, 21 May 2021 00:38:11 +0300	[thread overview]
Message-ID: <20210520213812.50976-1-gorcunov@gmail.com> (raw)

This allows `xlog` Lua module to decode appropriate
types into symbolic form.

For example with the patch we should see raft and
promote types in output.

 | $ tarantoolctl cat 00000000000000000004.xlog
 | ---
 | HEADER:
 |   lsn: 2
 |   group_id: 1
 |   type: RAFT
 |   timestamp: 1621541912.4588
 | BODY:
 |   0: 3
 |   1: 4
 | ---
 | HEADER:
 |   lsn: 1
 |   replica_id: 4
 |   type: PROMOTE
 |   timestamp: 1621541912.4592
 | BODY:
 |   2: 0
 |   3: 0
 |   83: 3

Fixes #6088

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 .../unreleased/gh-6088-xlog-raft-lua.mg       | 19 +++++++++++++++++++
 src/box/iproto_constants.h                    |  4 ++++
 2 files changed, 23 insertions(+)
 create mode 100644 changelogs/unreleased/gh-6088-xlog-raft-lua.mg

diff --git a/changelogs/unreleased/gh-6088-xlog-raft-lua.mg b/changelogs/unreleased/gh-6088-xlog-raft-lua.mg
new file mode 100644
index 000000000..767cfbd07
--- /dev/null
+++ b/changelogs/unreleased/gh-6088-xlog-raft-lua.mg
@@ -0,0 +1,19 @@
+## bugfix/core
+ * Added decoding of election messages: `RAFT` and `PROMOTE` to
+   `xlog` Lua module (gh-6088). Otherwise `tarantoolctl` shows
+   plain number in `type`
+   ```
+   HEADER:
+     lsn: 1
+     replica_id: 4
+     type: 31
+     timestamp: 1621541912.4592
+   ```
+   instead of symbolic representation
+   ```
+   HEADER:
+     lsn: 1
+     replica_id: 4
+     type: PROMOTE
+     timestamp: 1621541912.4592
+   ```
diff --git a/src/box/iproto_constants.h b/src/box/iproto_constants.h
index 99c8ca184..7362ddaf1 100644
--- a/src/box/iproto_constants.h
+++ b/src/box/iproto_constants.h
@@ -305,6 +305,10 @@ iproto_type_name(uint16_t type)
 		return iproto_type_strs[type];
 
 	switch (type) {
+	case IPROTO_RAFT:
+		return "RAFT";
+	case IPROTO_PROMOTE:
+		return "PROMOTE";
 	case IPROTO_CONFIRM:
 		return "CONFIRM";
 	case IPROTO_ROLLBACK:
-- 
2.31.1


             reply	other threads:[~2021-05-20 21:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20 21:38 Cyrill Gorcunov via Tarantool-patches [this message]
2021-05-22 13:50 ` Vladislav Shpilevoy via Tarantool-patches
2021-05-24  8:47 ` Serge Petrenko via Tarantool-patches
2021-05-24  9:47 ` Kirill Yukhin via Tarantool-patches

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=20210520213812.50976-1-gorcunov@gmail.com \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] iproto: stringify IPROTO_RAFT, IPROTO_PROMOTE' \
    /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