Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH] iproto: stringify IPROTO_RAFT, IPROTO_PROMOTE
@ 2021-05-20 21:38 Cyrill Gorcunov via Tarantool-patches
  2021-05-22 13:50 ` Vladislav Shpilevoy via Tarantool-patches
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Cyrill Gorcunov via Tarantool-patches @ 2021-05-20 21:38 UTC (permalink / raw)
  To: tml; +Cc: Vladislav Shpilevoy

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-24  9:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-20 21:38 [Tarantool-patches] [PATCH] iproto: stringify IPROTO_RAFT, IPROTO_PROMOTE Cyrill Gorcunov via Tarantool-patches
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

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