[Tarantool-patches] [PATCH] iproto: stringify IPROTO_RAFT, IPROTO_PROMOTE
Cyrill Gorcunov
gorcunov at gmail.com
Fri May 21 00:38:11 MSK 2021
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 at 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
More information about the Tarantool-patches
mailing list