Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
eos
QuarkDB
Commits
5c8f7cd5
Commit
5c8f7cd5
authored
Apr 03, 2018
by
Crystal Chua
Browse files
add raft_leader_info command to always display output of current leader
parent
2dae2a20
Pipeline
#351172
passed with stages
in 24 minutes and 29 seconds
Changes
3
Pipelines
5
Hide whitespace changes
Inline
Side-by-side
src/Commands.cc
View file @
5c8f7cd5
...
...
@@ -83,6 +83,7 @@ struct cmdMapInit {
redis_cmd_map
[
"raft_handshake"
]
=
{
RedisCommand
::
RAFT_HANDSHAKE
,
CommandType
::
RAFT
};
redis_cmd_map
[
"raft_append_entries"
]
=
{
RedisCommand
::
RAFT_APPEND_ENTRIES
,
CommandType
::
RAFT
};
redis_cmd_map
[
"raft_info"
]
=
{
RedisCommand
::
RAFT_INFO
,
CommandType
::
RAFT
};
redis_cmd_map
[
"raft_leader_info"
]
=
{
RedisCommand
::
RAFT_LEADER_INFO
,
CommandType
::
RAFT
};
redis_cmd_map
[
"raft_request_vote"
]
=
{
RedisCommand
::
RAFT_REQUEST_VOTE
,
CommandType
::
RAFT
};
redis_cmd_map
[
"raft_fetch"
]
=
{
RedisCommand
::
RAFT_FETCH
,
CommandType
::
RAFT
};
redis_cmd_map
[
"raft_checkpoint"
]
=
{
RedisCommand
::
RAFT_CHECKPOINT
,
CommandType
::
RAFT
};
...
...
src/Commands.hh
View file @
5c8f7cd5
...
...
@@ -87,6 +87,7 @@ enum class RedisCommand {
RAFT_HANDSHAKE
,
RAFT_APPEND_ENTRIES
,
RAFT_INFO
,
RAFT_LEADER_INFO
,
RAFT_REQUEST_VOTE
,
RAFT_FETCH
,
RAFT_CHECKPOINT
,
...
...
src/raft/RaftDispatcher.cc
View file @
5c8f7cd5
...
...
@@ -49,6 +49,17 @@ LinkStatus RaftDispatcher::dispatch(Connection *conn, RedisRequest &req) {
return
conn
->
statusVector
(
this
->
info
().
toVector
());
}
case
RedisCommand
::
RAFT_LEADER_INFO
:
{
// safe, read-only request, does not need authorization
RaftStateSnapshotPtr
snapshot
=
state
.
getSnapshot
();
if
(
snapshot
->
status
!=
RaftStatus
::
LEADER
)
{
if
(
snapshot
->
leader
.
empty
())
{
return
conn
->
err
(
"unavailable"
);
}
return
conn
->
moved
(
0
,
snapshot
->
leader
);
}
return
conn
->
statusVector
(
this
->
info
().
toVector
());
}
case
RedisCommand
::
RAFT_FETCH_LAST
:
{
// safe, read-only request, does not need authorization
if
(
req
.
size
()
!=
2
&&
req
.
size
()
!=
3
)
return
conn
->
errArgs
(
req
[
0
]);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment